Sometimes it’s difficult to send email as some providers block port 25. They will force you to use their mailserver for outgoing mail. I recently encountered this phenomenon when I spend some time in a hotel for work. Their setup blocked port 25 and there was no way around it sending email directly. I was forced to use my webmail solution (Roundcube) for sending mail. Which is a bit awkward as I was able to read and receive mail using Mail.app.

I started digging around for a solution that might work and I found the most simple and elegant solution that was already available in Postfix. It was called submission (port 587) which only allowes access by authenticated users.

To enable this ready made configuration in Postfix you will need to edit the ‘master.cf‘ file in ‘/etc/postfix/‘. You need to uncomment the following lines and save the changes.

submission inet n – n – – smtpd
  -o smtpd_enforce_tls=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject

Then reload the changed configuration files into postfix with the command:

sudo postfix reload

Most mail clients like Mail.app and Thunderbird are able to use this port without any extra configuration. The only thing you will notice that you are able to send email which would otherwise be blocked.

Hope this will work as well for you as it did for me. I’ve also updated the regular documentation set to include this setting. Also don’t forget to open up this port in your firewall/router configuration.