From 152bc963bfebe36dcf6370457813321a70687353 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 25 Dec 2017 11:53:05 +0300 Subject: prettify mail template --- juick-api/src/main/java/com/juick/api/EmailManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 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 8e868ca0..eca2dfa3 100644 --- a/juick-api/src/main/java/com/juick/api/EmailManager.java +++ b/juick-api/src/main/java/com/juick/api/EmailManager.java @@ -18,6 +18,7 @@ import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import static com.juick.formatters.PlainTextFormatter.formatPost; +import static com.juick.formatters.PlainTextFormatter.formatUrl; @Component public class EmailManager implements ApplicationListener { @@ -44,10 +45,12 @@ public class EmailManager implements ApplicationListener { Session session = Session.getDefaultInstance(System.getProperties()); try { MimeMessage message = new MimeMessage(session); - message.setFrom(new InternetAddress("noreply@mail.juick.com")); + message.setFrom(new InternetAddress("juick@juick.com")); message.addRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(email)); message.setSubject(String.format("New message from %s", msg.getUser().getName())); - message.setText(formatPost(msg)); + 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))); Transport.send(message); } catch (MessagingException ex) { logger.error("mail exception", ex); -- cgit v1.2.3