aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-12-25 11:53:05 +0300
committerGravatar Vitaly Takmazov2017-12-25 11:53:05 +0300
commit152bc963bfebe36dcf6370457813321a70687353 (patch)
treec4611769b6e4639ae630dba3653e02708022d21e
parent5f3e74559144da2b659773a29f73211e2347dd16 (diff)
prettify mail template
-rw-r--r--juick-api/src/main/java/com/juick/api/EmailManager.java7
1 files 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<MessageEvent> {
@@ -44,10 +45,12 @@ public class EmailManager implements ApplicationListener<MessageEvent> {
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);