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

Conferences

Tips for how to ask for time off to attend conferences

Asking for time off to attend a conference can be nerve-racking, these tips will get you closer to attending the conferences you're interested in.

Ruby

Using the 'it' Gem to add links to translations

How to can use the 'it' Gem to add links to your translations