How to enable port 587 (submission) in postfix

Monday, April 26, 2010 posted by Till

Some internet access providers have port 25 disabled in their routers to prevent spam. If you run your own mailserver in a datacenter, you might have to enable the submission port (587) in postfix to be able to send emails from your local email client to your own mailserver.

To enable port 587, edit the file /etc/postfix/master.cf

vi /etc/postfix/master.cf

and remove the # in front of the line:

#submission inet n – n – – smtpd

so that it looks like this:

submission inet n – n – – smtpd

and restart postfix:

/etc/init.d/postfix restart

Be Sociable, Share!


12 Responses to “How to enable port 587 (submission) in postfix”

  1. Robbert says:

    Make sure you enable this port in your firewall settings in ISPCONFIG3 aswell. Otherwise it wont work.

  2. B. Davies says:

    It should work – I think , just punch in port 587 and voilla !!

  3. gboule35 says:

    you must also create an iptables prerouting for redirect inbound port 25 to port 587.

  4. Rob says:

    That is not true And Would not add a benefit

  5. Mark says:

    Great post. I have been trying to get my postfix server to accept email from external authenticated clients on both port 25 and 587 for days, and haven’t been able to get it to work. I uncommented the submission line in master.cf, and opened up port 587 on my amazon server, and it worked! If only I had found this earlier. Thanks.

  6. Show!!!

    Simple and objective.

  7. Dylan Myers says:

    You guys are all missing something very important here. “Submission” isn’t meant to be a straight copy of the plain auth port 25. Its meant to be encrypted. This is a ‘correct’ “Submission” entry in master.cf:

    submission inet n – n – – smtpd
    -o smtpd_tls_security_level=encrypt
    -o smtpd_sasl_auth_enable=yes
    -o smtpd_client_restrictions=permit_sasl_authenticated,reject
    -o milter_macro_daemon_name=ORIGINATING

    The milter macro line isn’t needed in all configs, you should know what you’re doing before you rock and roll.

    IMO you should probably not be using port 25 OR port 587. You should be using SSL (465), which is properly configured like this:

    smtps inet n – n – – smtpd
    -o smtpd_tls_wrappermode=yes
    -o smtpd_sasl_auth_enable=yes
    -o smtpd_client_restrictions=permit_sasl_authenticated,reject
    -o milter_macro_daemon_name=ORIGINATING

    And is what I actually am using on my production server.

  8. Boyan Alexiev says:

    Dear Dylan,

    nice note about the TLS. However not only the milter line depends on the specific configuration, but all lines, and they also should exist in the version of postifx that is used. For example, another possible option is “-o smtpd_enforce_tls=yes”, but it may be deprecated (haven’t checked so far).

    As for the SSL and port, please note that port 465 is deprecated for SMTPS and is no longer RFC-compliant. This port is already assigned for different purposes. Wiki provides more info, you can also check the RFC. Hope this helps.
    http://en.wikipedia.org/wiki/SMTPS

  9. Chandan says:

    Cool….Simply awesome!!!

  10. Joseph says:

    Just wondering if its possible to restrict all out-going mails to port 587 and NOT allow any sending out of emails on port 25.

    Port 25 should only be used to receive mail and NOT send out …How can I do this?

  11. nicopingu says:

    thank you a lot !

  12. Fábio F says:

    perfect.

    Thanks for this post, was very helpful.

Leave a Reply