4

I've recently built a server using 14.04.1 LTS, I wanted a very quick and simple way for it to let me know if, for example, it needed a system restart after installing upgrades. I decided e-mail was the best option.

I've installed, configured and tested ssmtp to use one of my usual e-mail services.

Also, I've configured unattended-upgrade to e-mail me after any upgrades, at least initially.

Can I get the unattended-upgrade e-mail to come from a specific address? I know I can do that using just mail or ssmtp directly but if I don't specify a "from" address then it defaults to my mail service's default account and I want it to be clear it came from this particular machine. Where can I specify a "from" address for the mail command that unattended-upgrade uses?

3

Just specify an alias in your mail.rc file:

alias root root<ParticularMachine@YourDomain.com>
1

@Fabby - Thank you for your suggestion, I couldn't find a mail.rc file anywhere but you pointed me in the right direction. (I tried to vote up your answer but I'm apparently too much of a noob!)

Just to check, I did a sendmail -V which confirmed that I was using sSMTP.

Re-reading the docs on sSMTP pointed me at setting an alias as suggested but in either /etc/aliases or /etc/ssmtp/revaliases.

/etc/aliases already contained an entry for root - and changing it seems to have no visible effect on sent e-mail headers or contents. (Is it for incoming mail I'm thinking...?)

However, adding:

root:MyName@MyDomain.com:MyMailHub.com

to /etc/ssmtp/revaliases did result in mail generating a message with:

From: root <MyName@MyDomain.com> 

which isn't exactly what I wanted but is good enough.

Ironically, when I logged into the server to try this, it informed me that a system restart was required but I have no e-mail to alert me to that so I must still not have that set up correctly... back to square one!

  • Hmm, did this really solve your problem? It seems from your last sentence that it didn't really.. – Seth Dec 2 '14 at 0:09
  • Thank you Seth for amending the formatting of my posts to be more forum-appropriate - noted for future posts. Lol, my last sentence was really just me nit-picking. My aim was simply to identify this machine as the source of the e-mail when it reached my (external) inbox - this it now does but Outlook currently simply displays this in my message list as being from just "root" - but opening or previewing the e-mail shows me the machine name. My intention was to write a rule to highlight such messages and I believe I can do that now. – jarsudsco Dec 2 '14 at 1:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.