3

my ssmtp doesn't change "To" from 'root' to my email.

In my ssmtp.conf I have: root=servers@latina.com

In debug output I found only one difference between working and not working commands:

working command: echo "body" | mail -s "test" servers@latina.com

debug output:

Feb 16 13:28:20 deb1-sh sSMTP[21160]: To: servers@latina.com

not working command: echo "body" | mail -s "test" root

debug output:

Feb 16 13:27:21 deb1-sh sSMTP[21151]: To: root

According to this post:http://possiblelossofprecision.net/?p=591 I tried to add file /etc/mail.rc with following content:

alias root servers@latina.com

With no success.

I run debian jessie 8.3.

It looks like ssmtp root alias doesn't work. Has anybody idea why? Or how to solve this issue? Thank you.

Vaclav Kasal
  • 130
  • 1
  • 5
  • 2
    I'm suffering from the same issue. `ssmtp root` works (mail is sent to the address specified in ssmtp.conf root=... line), but at the same time `mail root` does not work. The latter call generates an error in `/var/log/mail.err` ("553 5.1.8 Domain name required: ") that indicates that the To-address was not re-written. I have confirmed that `mail` actually reads the `/etc/mail.rc` file on my system using `strace`. – dasup Mar 07 '18 at 17:40

2 Answers2

2

As I understand it, the root configuration setting for sSMTP is only used for local accounts so should be set to a username that’s valid for the local host. It’s not an alias like those used by other more fully-featured MTAs (which can be used to forward mail to another domain).

The comments in my /etc/ssmtp/ssmtp.conf state

(5) root

If sSMTP finds an unqualified e-mail address among the recipients, and it corresponds to a username on your local machine with a userid less than 1000, then the e-mail is sent to this value instead. The idea is that mail sent to 'root' should probably go to 'postmaster' instead.

Anthony Geoghegan
  • 2,800
  • 1
  • 23
  • 34
0

ssmtp does not replace mail. I got it working by using ssmtp binary instead of mail.mailutils. You can test it by running this command: MAIL=$(which mail) mv "${MAIL}" "${MAIL}.orig" && ln -s $(which ssmtp) "${MAIL}"

Gadelkareem
  • 171
  • 1
  • 7