email - Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? -
i getting following error when setting email service spring boot while trying connect round cube:
caused by: javax.net.ssl.sslexception: unrecognized ssl message, plaintext connection?
this leads me think roundcude not using ssl connection , should not use port 143. therefore try , use port 25, following error when do.
caused by: javax.net.ssl.sslexception: unrecognized ssl message, plaintext connection?
application.properties
#email setup spring.mail.host = mail.email address.com spring.mail.username = email address spring.mail.password = password spring.mail.properties.mail.smtp.auth= true spring.mail.port = 25 or port 145 spring.mail.properties.mail.smtp.socketfactory.class= javax.net.ssl.sslsocketfactory spring.mail.properties.mail.smtp.socketfactory.fallback= false spring.mail.properties.mail.smtp.ssl.enable = true
email service
@component public class emailserviceimpl implements emailservice { @autowired private javamailsender javamailsender; @override public void sendemail(string toaddress, string fromaddress, string subject, string body) { simplemailmessage simplemailmessage = new simplemailmessage(); simplemailmessage.setfrom(fromaddress); simplemailmessage.setto(toaddress); simplemailmessage.setsubject(subject); simplemailmessage.settext(body); javamailsender.send(simplemailmessage); } }
i looked @ roundcube's documentation , apparently uses port 143 rather confusing. making me think setting wrong.
i tried gmail since have 2 factor authentication ran more issue decided use roundcube rather use anyway.
advice?
it seems you're trying connect smtp using non-secure ports. secure ports 587 or 465.
this configuration works me send e-mail using gmail:
spring.mail.host=smtp.gmail.com spring.mail.port=587 spring.mail.username=my-email@gmail.com spring.mail.password=my-password spring.mail.properties.mail.smtp.auth = true spring.mail.properties.mail.smtp.starttls.enable = true spring.mail.properties.mail.smtp.socketfactory.class = javax.net.ssl.sslsocketfactory spring.mail.properties.mail.smtp.connectiontimeout = 60000 spring.mail.properties.mail.smtp.timeout = 60000
Comments
Post a Comment