3

I am getting the following error when I try to send email using a relayhost from a CentOS 7 server using postfix:

Oct 19 19:53:08 localhost postfix/pickup[7174]: 64DAF1A53CB: uid=1002 from=<me>
Oct 19 19:53:08 localhost postfix/cleanup[7184]: 64DAF1A53CB: message-id=<20151020025308.64DAF1A53CB@mydomain.com>
Oct 19 19:53:08 localhost postfix/qmgr[7175]: 64DAF1A53CB: from=<me@mydomain.com>, size=447, nrcpt=1 (queue active)
Oct 19 19:53:08 localhost postfix/smtp[7177]: CLIENT wrappermode (port smtps/465) is unimplemented
Oct 19 19:53:08 localhost postfix/smtp[7177]: instead, send to (port submission/587) with STARTTLS
Oct 19 19:53:18 localhost postfix/smtp[7177]: 64DAF1A53CB: to=<test.account@anotherdomain.com>, relay=emailserver.com[ip.of.email.server]:465, delay=10, delays=0.06/0/10/0, dsn=d.s.n, status=deferred (lost connection with emailserver.com[ip.of.email.server] while receiving the initial server greeting)  

The steps I took leading up to this are:

# yum -y install postfix cyrus-sasl-plain mailx
# systemctl restart postfix
# systemctl enable postfix
# vi /etc/postfix/main.cf
//Add the following at THE VERY END OF THE FILE:
myhostname = mydomain.com
relayhost = [emailserver.com]:465
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
// save and close, then create the following new file:
# vi /etc/postfix/sasl_passwd
// add the following one line:
[emailserver.com]:465 username:password
// save and close the file
// create a postfix lookup table by running the following command:
# postmap /etc/postfix/sasl_passwd
// restrict access to the file:
# chown root:postfix /etc/postfix/sasl_passwd*
# chmod 640 /etc/postfix/sasl_passwd*
# systemctl reload postfix

Then I set up a new user on CentOS named "me" and entered the following command:

echo "This is a test." | mail -s "test message" test.account@anotherdomain.com

When I change port 465 to port 587 in the above commands, I am able to successfully send a message using the echo command. However, the emailserver.com customer support line says that port 465 is SSL only, and that port 587 has SSL disabled, so the problem here is that SSL does not work. How can I set this up so that SSL SMTP is sent through port 465?

Note that the CentOS 7 development server is behind a residential cable modem with port 25 disabled, so I have no choice but to use a relayhost. Also, I want to use port 465 to ensure an SSL connection. The email must travel via SSL.

The entire /etc/postfix/main.cf file contents are:

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
inet_interfaces = localhost
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.10.1/samples
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES

#####################################################################
### Everything below was added to set up relayhost for smtp
#####################################################################

myhostname = mydomain.com

relayhost = [emailserver.com]:465
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous  

NOTE: In firewalld, I set the smtp.xml file to use port 465 for smtp instead of port 25. But I did not create an smtps service. I don't think this is relevant, but I thought I would share it in case it is relevant.

1

At the time of this posting, the server on which I was testing the above did not have its own signed SSL certificate. (It was using a private certificate at that time.) The remote mail server required a signed SSL certificate and thus refused the OP's request for connections, and thus triggered the error which led to this posting.

In this case, the resolution involved using a signed SSL certificate. But the error could also be resolved by using mail servers that allow trusted unsigned certificates, or by sending unencrypted requests.

  • Use TLS, 587 (emailserver.com:submission) and not 465. TLS1.2 is far more secure & compatible than SSL wrappers and wouldn't have this issue.. – Jacob Evans Nov 7 '15 at 3:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.