Allowing your own From header with sSMTP

Today I was wrestling with some email issues on a server and decided to install sSMTP as opposed to Sendmail for sending email out to their internal SMTP server.

First thing I should say is that installing it was a real dream compared to the messing around I had previously done with Sendmail and whilst I know it is no longer maintained it seems very solid and does exactly what I need it to.

One thing that perplexed me however was that whilst I was able to change most of the normal headers by simply passing them in using the PHP mail() function I was unable to set the 'From: ' header.

Since sSMTP uses the www-data user when it is running this is who was coming up as the sender, which is very ugly and not very helpful to the user.

Luckily there is a one line fix for this problem, in the ssmtp.conf file (found in my system at /usr/local/etc/ssmtp/ssmtp.conf) add the following line.

FromLineOverride=YES

This will then allow PHP to set whatever From header it wants.

Recent posts View all

Marketing

How to build your email list

We look at some ways you can build your email list

SEO

Google Search Console and S3

Hosting your sitemap somewhere other than your main domain requires some additional steps in Google Search Console