aboutsummaryrefslogtreecommitdiff
path: root/juick-api
diff options
context:
space:
mode:
Diffstat (limited to 'juick-api')
-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);