Page 1 of 1

Error plugins.mail.sendMail() Could not convert socket

PostPosted: Tue Nov 07, 2017 4:21 pm
by stefaniacolombara
Hello,
the method sendMail() of the plugin "plugins.mail" shows the following error:

"Could not convert socket to TLS".

In particular, this the part of my code:
plugins.mail.sendMail(to, from, subject, msgText, "", "", [], properties);

and i set properties with the following parameters:
properties=["mail.smtp.host=mail.smartmailtim.it","mail.smtp.auth=true","mail.smtp.username=xxx@yyy.191.it","mail.smtp.starttls.enable=true","mail.smtp.port=587","mail.smtp.password=ZZZZZZZ”,”mail.smtp.co
nnectiontimeout=10000","mail.smtp.timeout=10000","mail.smtp.ssl.enable=false"]

Any ideas about how to solve it?

Thank you all, Rosy

Re: Error plugins.mail.sendMail() Could not convert socket

PostPosted: Sun Nov 12, 2017 10:57 am
by steve1376656734
This kind of error generally indicates a problem with the SSL certificate. There is a command line utility called smtpsend that is part of the java mail package that can be used to test the connection and get better error messages.

Does the name on the SSL certificate match the hostname you have specified? If not then change the mail.smtp.host property to match the SSL certificate name (assuming this resolves to the correct IP address). If the address does not resolve as you want it to, and you REALLY trust the mail host, then you can add mail.smtp.ssl.trust=mail.smartmailtim.it to the properties. This will ignore any SSL certificate mismatches for that host and make the connection BUT be aware that you open yourself up to a man in the middle attack with this.

It is always better to resolve the SSL certificate mismatch issue rather than use this approach but it can get you out of a hole in the short term.

Hope this helps
Steve