aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-12-25 14:25:39 +0300
committerGravatar Vitaly Takmazov2017-12-25 14:25:39 +0300
commiteda320df70c204fed7cbfb3b356b9c65b38db397 (patch)
tree6601d103fed3f665f522760a7ad9e0f3f6b919e0 /juick-api/src/main/java/com
parentad7b47d7b928d7f1100abfbee1ff82f526eafce2 (diff)
transport connect
Diffstat (limited to 'juick-api/src/main/java/com')
-rw-r--r--juick-api/src/main/java/com/juick/api/EmailManager.java9
1 files changed, 8 insertions, 1 deletions
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 1573e7be..2c48a745 100644
--- a/juick-api/src/main/java/com/juick/api/EmailManager.java
+++ b/juick-api/src/main/java/com/juick/api/EmailManager.java
@@ -56,13 +56,20 @@ public class EmailManager implements ApplicationListener<MessageEvent> {
Session session = Session.getDefaultInstance(prop);
try {
Transport transport = session.getTransport("smtp");
- MimeMessage message = new MimeMessage(session);
+ MimeMessage message = new MimeMessage(session) {
+ protected void updateMessageID() throws MessagingException {
+ if (getHeader("Message-ID") == null)
+ super.updateMessageID();
+ }
+ };
message.setFrom(new InternetAddress("juick@juick.com"));
message.addRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(email));
message.setSubject(subject);
message.setText(String.format("%s\n%s\n---\nYou are receiving this because you are subscribed to this user " +
"or discussion. Configure notifications at https://juick.com/settings",
formatPost(msg), formatUrl(msg)));
+ message.saveChanges();
+ transport.connect();
transport.sendMessage(message, message.getAllRecipients());
} catch (MessagingException ex) {
logger.error("mail exception", ex);