# SSMTP problem



## hulleyrob (Feb 19, 2018)

Ive installed SSMTP and followed various blogs to say how to switch from sendmail to ssmtp.

However I do receive mail at the correct address but the to address show is root@"sending_domain" 

This was very alarming as it appears my emails were going to someone else account. They are not and I do get them all but this seems very odd.

Has anyone else come across it and if so how can I fix it?

Here is my /etc/mail/mailer.conf


```
sendmail        /usr/local/sbin/ssmtp
send-mail       /usr/local/sbin/ssmtp
mailq           /usr/local/sbin/ssmtp
newaliases      /usr/local/sbin/ssmtp
hoststat        /usr/bin/true
purgestat       /usr/bin/true
```

Thanks

Rob


----------



## VladiBG (Feb 20, 2018)

Hello Rob,

By default all periodic output is send to root@FQDN  as is stated in /etc/defaults/periodic.conf that's why when you create an alias in /etc/mail/aliases for root and update the /etc/mail/aliases.db using `newaliases`command you start receiving the e-mails that are addressed to root. I will suggest you to stay with default sendmail for simple mail delivery/forwarding and NOT to modify the defaults.


----------



## hulleyrob (Feb 20, 2018)

There was some reason why I switched to SSMTP maybe to send to a gmail account?

The thing is if it was sending to the root@FQDN then I would see a different value in the to field than I do.

I can live with it as it is not sending any mail to that address I have checked but still its very odd behaviour to just send to root at the SMTP server domain.

Thanks for your input but at the moment im unable to remember why I do it this way but sure it was for a good reason.

Regards

Rob


----------



## VladiBG (Feb 21, 2018)

SSMTP is using RewriteDomain option that you have to check in your ssmtp.conf


----------



## vejnovic (Feb 21, 2018)

My working ssmpt.conf (/usr/local/etc/ssmpt/ssmtp.conf), replace `your-mailserver.example.com` with FQDN of your mailserver, replace `example.com` with your domain and `your-host-name` with your real hostname.

```
#
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
#

# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=postmaster

# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
# The example will fit if you are in domain.com and your mailhub is so named.
mailhub=your-mailserver.example.com

# Where will the mail seem to come from?
rewriteDomain=your-host-name.example.com

# The full hostname
hostname=your-host-name.example.com
```


----------



## hulleyrob (Feb 21, 2018)

Hmm over tried both including and commenting out that option in the config and it had no effect with a completely different domain to check It was doing something. 

I’m lost on what is the cause of this to be honest. It works but looks wrong. And I’ve registered the email address it appeared to be going to and can confirm no emails are actually going there.


----------

