I have posted this question on Sever Fault but as soon as I mentioned that I have a control panel installed on my server (even though it has nothing to do with the issue) my question was closed.

Here it is:

I have a Centos 6.5 VPS (with ISPConfig panel) and was recently attempting to install a SSL/TLS certificate for my email communication (the certificate is a standard RapidSSL one).

I am baffled by an issue which is that Dovecot accepts my SSL certificate just fine and allows me to receive emails without any problems but Postfix rejects the connection (The message I get in ThunderBird is: "The message could not be sent because connection to Outgoing server (SMTP) mail.example.com failed. The server may be unavailable or is refusing Outgoing server (SMTP) connections. Please verify that your Outgoing server (SMTP) settings are correct and try again").

Postfix works fine with STARTTLS and plain authentication on port 587 but does not work with SSL/TLS on port 465.

I am new to email systems so I am completely unsure as to what might have cause this issue.

This is my master.cf for postfix:

smtp      inet  n       -       n       -       -       smtpd
submission inet n       -       n       -       -       smtpd
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_tls_security_level=may
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions= permit_sasl_authenticated, reject
#  -o milter_macro_daemon_name=ORIGINATING
# 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
#628      inet  n       -       n       -       -       qmqpd
pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       n       300     1       oqmgr
tlsmgr    unix  -       -       n       1000?   1       tlsmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify
flush     unix  n       -       n       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       n       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       n       -       -       smtp
        -o smtp_fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
retry     unix  -       -       n       -       -       error
discard   unix  -       -       n       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
scache    unix  -       -       n       -       1       scache
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}
dovecot   unix  -       n       n       -       -       pipe
  flags=DROhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${user}@${nexthop}
amavis unix - - - - 2 smtp
        -o smtp_data_done_timeout=1200
        -o smtp_send_xforward_command=yes inet n - - - - smtpd
        -o content_filter=
        -o local_recipient_maps=
        -o relay_recipient_maps=
        -o smtpd_restriction_classes=
        -o smtpd_client_restrictions=
        -o smtpd_helo_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o mynetworks=
        -o strict_rfc821_envelopes=yes
        -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks

amavisfeed unix    -       -       n        -      2     lmtp
    -o lmtp_data_done_timeout=1200
    -o lmtp_send_xforward_command=yes
    -o disable_dns_lookups=yes
    -o max_use=20

And here is my Postfix main.cf

sendmail_path = /usr/sbin/sendmail.postfix

# newaliases_path: The full pathname of the Postfix newaliases command.
# This is the Sendmail-compatible command to build alias databases.
newaliases_path = /usr/bin/newaliases.postfix

# mailq_path: The full pathname of the Postfix mailq command.  This
# is the Sendmail-compatible mail queue listing command.
mailq_path = /usr/bin/mailq.postfix

# setgid_group: The group for mail submission and queue management
# commands.  This must be a group name with a numerical group ID that
# is not shared with other accounts, not even with the Postfix account.
setgid_group = postdrop

# html_directory: The location of the Postfix HTML documentation.
html_directory = no

# manpage_directory: The location of the Postfix on-line manual pages.
manpage_directory = /usr/share/man

# sample_directory: The location of the Postfix sample configuration files.
# This parameter is obsolete as of Postfix 2.1.
sample_directory = /usr/share/doc/postfix-2.6.6/samples

# readme_directory: The location of the Postfix README files.
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
virtual_alias_domains =
virtual_alias_maps = hash:/etc/mailman/virtual-mailman, proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, proxy:mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /var/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf
smtpd_tls_auth_only = no
smtpd_tls_security_level = may
# smtpd_tls_cert_file = /etc/postfix/smtpd.cert
# smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_tls_cert_file = /usr/certs/mail_xxxx_xx.pem
smtpd_tls_key_file = /usr/certs/mail_xxxx_xx.key
transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
relay_domains = mysql:/etc/postfix/mysql-virtual_relaydomains.cf
relay_recipient_maps = mysql:/etc/postfix/mysql-virtual_relayrecipientmaps.cf
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks
smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf
smtpd_client_restrictions = check_client_access mysql:/etc/postfix/mysql-virtual_client.cf
smtpd_client_message_rate_limit = 100
maildrop_destination_concurrency_limit = 1
maildrop_destination_recipient_limit = 1
virtual_transport = dovecot
header_checks = regexp:/etc/postfix/header_checks
mime_header_checks = regexp:/etc/postfix/mime_header_checks
nested_header_checks = regexp:/etc/postfix/nested_header_checks
body_checks = regexp:/etc/postfix/body_checks
smtp_tls_security_level = may
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_protocols = !SSLv2,!SSLv3
smtp_tls_protocols = !SSLv2,!SSLv3
myhostname = mail.xxxx_xx
mynetworks = [::1]/128
#mynetworks = [::1]/128
dovecot_destination_recipient_limit = 1
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
content_filter = amavis:[]:10024
receive_override_options = no_address_mappings
relayhost =
mailbox_size_limit = 0
message_size_limit = 0

I would really appreciate if someone could help resolve this annoying issue.

update: (I can't comment on this stack exchange site yet). My postfix version is 2.6.6

update2: even if I uncomment the smtps block in the master.cf file the connection is still rejected.

  • I am no user of Dovecot because my postfix config is send-only. Your receiving email using postfix proves your MTA is up and your MUA performs well (with attendant certificates) too. The question may be that certificates are handled differently for incoming mail and outgoing mail MUA-MTA interaction. --- But aren't you missing a correctly specified "relayhost" in yr main.cf? Also Isn't your "myhostname" parameter wrongly defined ? My own set up of postfix is much simpler because I do not use certificates yet. But I'd be interested....
    – Cbhihe
    Commented Sep 28, 2015 at 7:36
  • 1
    BTW, port 465 is deprecated since RFC2487 (late 90s) - see tools.ietf.org/html/rfc2487.. What is yr postfix version ?
    – Cbhihe
    Commented Sep 28, 2015 at 7:51

2 Answers 2


You have to uncomment the smtps block in your main.cf, then restart Postfix. STARTTLS works because it uses the standard smtp port (25).

  • The -o ... lines after the submission and smtps lines in main.cf should probably be uncommented too, or else the ports (587 and 465 respectively) might also allow unauthenticated traffic.
    – telcoM
    Commented Oct 13, 2019 at 11:39

If you have any firewalls installed on your machine, you have to add port rules to that firewalls. Firewall examples: iptables, ufw

Most of the time developers configured mail servers like dovecot and postfix, but they forgot to add rules for ports like 25, 143, 587, 993.

For enabling ports on UFW:

ufw status // this will list all current rules
ufw allow [port] //For example: ufw allow 25

For adding rules to iptables:

sudo iptables -A INPUT -p tcp --dport 25 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 25 -m conntrack --ctstate ESTABLISHED -j ACCEPT

sudo iptables -A INPUT -p tcp --dport 143 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 143 -m conntrack --ctstate ESTABLISHED -j ACCEPT

sudo iptables -A INPUT -p tcp --dport 993 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 993 -m conntrack --ctstate ESTABLISHED -j ACCEPT

sudo iptables -A INPUT -p tcp --dport 110 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 110 -m conntrack --ctstate ESTABLISHED -j ACCEPT

sudo iptables -A INPUT -p tcp --dport 995 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 995 -m conntrack --ctstate ESTABLISHED -j ACCEPT

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .