Postfix relay with STARTTLS - TLS is required, but was not offered by host
i need send email through an exetrnal SMTP, is use STARTTLS, my postconf -n is:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks = 0.0.0.0/0
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
relayhost = xx.xx.xx.xx:2525
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_note_starttls_offer = yes
smtp_tls_policy_maps = hash:/etc/postfix/tls_policy
smtp_tls_security_level = may
smtp_use_tls = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
unknown_local_recipient_reject_code = 550
/etc/postfix/sasl_passwd
xx.xx.xx.xx:2525 user:password
/etc/postfix/tls_policy
xx.xx.xx.xx:2525 encrypt
I have this error:
Jul 6 17:49:11 ip-10-1-4-140 postfix/smtp[25156]: 95F826276D: to=<[email protected]>, relay=xx.xx.xx.xx[xx.xx.xx.xx]:2525, delay=0.43, delays=0.23/0.01/0.19/0, dsn=4.7.4, status=deferred (TLS is required, but was not offered by host xx.xx.xx.xx[xx.xx.xx.xx])
Any idea?
Solution 1:
This is something that could happen when you have smtp_use_tls = yes
.
smtp_use_tls
(default:no
)Opportunistic mode: use TLS when a remote SMTP server announces STARTTLS support, otherwise send the mail in the clear. Beware: some SMTP servers offer STARTTLS even if it is not configured. With Postfix < 2.3, if the TLS handshake fails, and no other server is available, delivery is deferred and mail stays in the queue. If this is a concern for you, use the smtp_tls_per_site feature instead.
Solution 2:
No need to do any changes in postfix. Just check your router/firewall is allowing mail services. You can test it by following below command.
telnet smtp.gmail.com 587 <-- enter
enter your Gmail username.
EHLO [email protected] <-- enter,
after this you should see output like below.
250-smtp.gmail.com
250-8BITMIME
250-SIZE 10485760
250-STARTTLS
250-AUTH PLAIN LOGIN
250 Ok
421 Timeout waiting fothe r data from client.
If you are not finding STARTTLA then your router/firewall is blocking. Unblock the 25,587 and 465 it will work fine.
I hope, this will solve your issue.