If you need to enable SSL for your SMTP email server it's very easy to configure a couple of properties and let ATG handle the necessary configs and setup for the corresponding JavaMail
All you need to do is set the following properties in /atg/dynamo/service/SMTPEmail/:
emailHandlerPort=465 (the default SSL port for SMTP)
protocolName=smtps
And that's it, turn on the debug for SMTPEmail and you will see it is attempting an SSL connection:
**** debug Mon Aug 03 17:05:22 CDT 2020 1596492322205 /atg/userprofiling/email/TemplateEmailSender doSendEmailMessage: numMessages = 2
DEBUG: setDebug: JavaMail version 1.5.6
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle]
**** debug Mon Aug 03 17:05:22 CDT 2020 1596492322215 /atg/dynamo/service/SMTPEmail Attempting to open a connection...
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "localhost", port 465, isSSL true
DEBUG SMTP: EOF: [EOF]
DEBUG SMTP: could not connect to host "localhost", port: 465, response: -1
**** debug Mon Aug 03 17:05:23 CDT 2020 1596492323434 /atg/dynamo/service/SMTPEmail Connection failed on try 1 of 4.
**** debug Mon Aug 03 17:05:23 CDT 2020 1596492323434 /atg/dynamo/service/SMTPEmail Attempting to open a connection...
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "localhost", port 465, isSSL true
**** Error Mon Aug 03 17:05:52 CDT 2020 1596492352208 /atg/dynamo/service/SMTPEmail Could not open an SMTP connection
Of course, the log above is just for illustrative purpose, to depict the isSSL flag set to true
In case you wanna use another provider just use the default configured ones within META-INF/javamail.default.providers:
# JavaMail IMAP provider
protocol=imap; type=store; class=com.sun.mail.imap.IMAPStore; vendor=Oracle;
protocol=imaps; type=store; class=com.sun.mail.imap.IMAPSSLStore; vendor=Oracle;
# JavaMail SMTP provider
protocol=smtp; type=transport; class=com.sun.mail.smtp.SMTPTransport; vendor=Oracle;
protocol=smtps; type=transport; class=com.sun.mail.smtp.SMTPSSLTransport; vendor=Oracle;
# JavaMail POP3 provider
protocol=pop3; type=store; class=com.sun.mail.pop3.POP3Store; vendor=Oracle;
protocol=pop3s; type=store; class=com.sun.mail.pop3.POP3SSLStore; vendor=Oracle;
Interesting, Thanks for Sharing!
ReplyDelete