Some SMTP servers have stricter requirements and/or different configurations than others. One example is Office365. This article will focus on Office365, but may be applicable to other SMTP hosts.
First, two links for later:
http://docs.apigee.com/private-cloud/latest/configuring-edge-smtp-server
http://docs.apigee.com/private-cloud/latest/how-configure-edge
If you have followed the article linked above to configure your SMTP server, but are getting the following error message, please read on:
[error] a.d.Dispatcher - Sending the email to the following server failed : smtp.office365.com:465 org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.office365.com:465 ... Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.office365.com, port: 465 ... Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? ...
At first, you may be wondering why port 465 is showing up in logs above when you may have configured 587. If this were the only problem, a simple workaround would be to use iptables. For reference, the following iptables definitely works (but unfortunately doesn't help for this issue, as the port isn't the only problem):
sudo iptables -t nat -A OUTPUT -p tcp --dport 465 -j DNAT --to-destination :587
(Note that even with that iptables rule, you will still see port 465 in the logs. The iptables rule technically works, but there's more to this than just the port).
After making the following changes (and removing iptables):
conf_apigee_mail.smtp.host="smtp.office365.com" conf_apigee_mail.smtp.port="587" conf_apigee_mail.smtp.channel="tls" conf_apigee_mail.smtp.tls="true"
I was getting this error:
Sending the email to the following server failed : smtp.office365.com:587 org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.office365.com:587 ... Caused by: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM ...
This final error can be solved by providing the full name and email address of the user sending the mail, for example (note the below must be EXACTLY right, and you can get this info from your SMTP provider):
conf_apigee_apigee.mgmt.mailfrom="First Last <email@outlook.com>"
Note all the above configs are set in /opt/apigee/token/application/ui.properties per the "How to Configure Edge" link above. Also, after these are set, the UI must to be restarted using apigee-service. Also note that if you change your SMTP password, you must re-run the UI installer using your silent config file from initial installation.
I hope this helps. Thanks.
Handling special characters in passwords when installing Edge Private Cloud 4.16.01
Private Cloud 4.16.X: Edge UI not sending emails - Troubleshooting tips
How to disable TRACE method from the router configuration level
Apigee Edge for Private Cloud v4.16.09 doc available
How to enable Debug in the Apigee Edge Router and Message Processor?
LDAP_PEER variable found and not in response file
Creating a symlink from /opt/apigee to install Edge for Private Cloud 4.16.01
How to reset a lost sysadmin password on Apigee Edge OPDK?