Sending Mail from a Vagrant box

Spoilers – I went with sSMTP, and the details of how I did it are here.

Option 1 – use sSMTP instead of Sendmail

Most config is from here but using the settings from Outlook Web Access (Settings cog -> Mail -> Accounts -> POP and IMAP, look in the SMTP setting section). This means having a new bit of software installed and configured (possibly via Vagrant?) This is what eventually worked for me (see sSMTP post here).

Option 2 – just use Sendmail, but configure it for SMART_HOST

See here or here for details but they don’t include TLS. But this one seems to, as does this one (though it’s quite old). This one seems to have a cleaner way to do TLS.And this one seems to be the nicest.

No new software required, though again some config is needed (and ideally would be added to the Vagrant scripts).

Option 3 – use Sendmail but with nullclient

See here for details … I haven’t found anywhere that suggests this works with TLS, and I don’t expect O365 to accept SMTP traffic that isn’t secure. So I’m guessing this probably won’t work.

Option 4 – use Postfix instead of Sendmail

Try the instructions on here or here or here or here. According to some, it’s easier than Sendmail, but again it’s a new bit of software to install and configure. And it’s not that much easier than sendmail.

Option 5 – just add Mailutils

I did sudo apt-get install mailutils from the command line (it needed some interactive install config questions). Went smoothly – and it seems to have installed postfix – but didn’t actually help much.

The results – sSMTP wins (for me at least)

I spent quite a bit of time on most of these options, and the first one I got to work  was sSMTP – I’ve gotten it to send a test email from the command line and (eventually) from PHP. Details are in this blog post.

What’s left

Currently, any time my Vagrant box dies and is rebuilt, I’ll have to do this manual config again. One day I’ll probably get tired of that and update the Vagrant files to do that during provisioning (after digging up the doco on how to do that…)

Sending Mail from a Vagrant box

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s