From e8ffd4497af18b22519c94f1b22c32ddf3d446f0 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 25 Dec 2017 12:03:31 +0300 Subject: trying to enable STARTTLS --- juick-api/src/main/java/com/juick/api/EmailManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/juick-api/src/main/java/com/juick/api/EmailManager.java b/juick-api/src/main/java/com/juick/api/EmailManager.java index eca2dfa3..edf7c000 100644 --- a/juick-api/src/main/java/com/juick/api/EmailManager.java +++ b/juick-api/src/main/java/com/juick/api/EmailManager.java @@ -17,6 +17,8 @@ import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; +import java.util.Properties; + import static com.juick.formatters.PlainTextFormatter.formatPost; import static com.juick.formatters.PlainTextFormatter.formatUrl; @@ -42,7 +44,9 @@ public class EmailManager implements ApplicationListener { } void emailNotify(String email, Message msg) { - Session session = Session.getDefaultInstance(System.getProperties()); + Properties prop = System.getProperties(); + prop.put("mail.smtp.starttls.enable", "true"); + Session session = Session.getDefaultInstance(prop); try { MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress("juick@juick.com")); -- cgit v1.2.3