Ubuntu – SSMTP mail server overriding the from to email address with Apache process user name

apache-2.2emailPHPUbuntu

I'm using the SSMTP mail server on my Ubuntu server to send emails from my PHP scripts using a 3rd party SMTP and all is working fine expect that the emails that are being sent have there from & reply-to email address set to "www-data@mydomain.com" instead of the ones provided to the mail() function.

I all so have the "FromLineOverride" set to "YES" in the "ssmtp.conf".
The only difference it seems to be making is that in the reply-to address it adds both the "www-data@mydomain.com" & the email address provided to the mail() function.

I have looked over every setting I could find but it still keeps using the Apache2's process user account as the from address.

Does anyone know why this is happening?

Best Answer

I had the same issue on my new dedicated server, which came without Postfix, but with ssmtp. All mails were sent with process user name and hostname like : user@host

In /etc/ssmtp/ssmtp.conf file I just added the following directive : FromLineOverride=YES, and now it works like a charm.

BTW, I'm agree, what Postfix is much better, just it takes some time to configure it properly, and something we need just simple email send.