When setting up SMTP for email, some common errors that may occur are:
- Connection Refused: This suggests that Data Collector is unable to establish a connection with the SMTP server. This can be caused by network issues, wrong address and port, or a firewall.
- Unsupported or unrecognized SSL message: This error can occur if trying to connect via SSL to a port that is not configured for SSL. Consider verifying the SSL/TLS protocol versions and configurations of that port.
-
Could not convert socket to TLS: This can occur when enabling STARTTLS to upgrade the socket connection to use TLS. There could possibly be a difference in TLS protocol versions or configurations between the socket and the Data Collector. TLS version can be specified in sdc.properties like so:
mail.smtp.ssl.protocols=TLSv1.2
-
Certificate Validation errors: This is typically caused by not having the server’s certificates imported in the truststore.
Useful tools:
The OpenSSL s_client can be very useful in analyzing client-server connections, seeing the server’s certificates, and testing SSL/TLS capability and configuration.
openssl s_client -connect <smtp-server-name>:<smtp-port> -starttls smtp -showcerts
Setting the following properties in the sdc.properties file can also provide some important information and debugging on the connection to the SMTP server.
mail.debug=true
mail.debug.auth=true