comparison src/nabble/view/lib/ChangeEmailMail.jtp @ 0:7ecd1a4ef557

add content
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 Mar 2019 19:15:52 -0600
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:7ecd1a4ef557
1 <%
2 package nabble.view.lib;
3
4 import fschmidt.util.mail.AlternativeMultipartContent;
5 import fschmidt.util.mail.Content;
6 import fschmidt.util.mail.Mail;
7 import fschmidt.util.mail.MailAddress;
8 import fschmidt.util.mail.MailException;
9 import fschmidt.util.mail.MailHome;
10 import fschmidt.util.mail.PlainTextContent;
11 import fschmidt.util.mail.TextContent;
12 import nabble.model.ModelHome;
13 import nabble.model.Site;
14
15 import java.io.PrintWriter;
16 import java.io.StringWriter;
17
18
19 public class ChangeEmailMail {
20
21 public static void send(Site site, String username, String oldEmail, String newEmail, String url) {
22 StringWriter content = new StringWriter();
23 PrintWriter out = new PrintWriter(content);
24 // text part
25 %>
26 Dear <%=username%>,
27
28 You or the administrator of "<%=site.getRootNode().getSubject()%>" wants to change the email address of your user account.
29 Username: <%=username%>
30 Old email address: <%=oldEmail%>
31 New email address: <%=newEmail%>
32
33 Please click on the link below if you want to confirm this change:
34 <%=url%>
35
36 If you didn't request this email or have no idea why you received it, please ignore it.
37
38 Regards,
39 The Nabble Team
40 <%
41 out.flush();
42 String text = content.toString();
43
44 content.getBuffer().setLength(0);
45 // aol part
46 %>
47 Dear <%=username%>,
48
49 You or the administrator of "<%=site.getRootNode().getSubject()%>" wants to change the email address of your user account.
50 Username: <%=username%>
51 Old email address: <%=oldEmail%>
52 New email address: <%=newEmail%>
53
54 Please click on the link below if you want to confirm this change:
55 <a href="<%=url%>"><%=url%></a>
56
57 If you didn't request this email or have no idea why you received it, please ignore it.
58
59 Regards,
60 The Nabble Team
61 <%
62 out.flush();
63 String aol = content.toString();
64
65 out.close();
66 try {
67 Mail mail = MailHome.newMail();
68 mail.setFrom( new MailAddress(ModelHome.noReply) );
69 mail.setTo( new MailAddress(newEmail) );
70 mail.setSubject( "Email Change" );
71 mail.setContent( new AlternativeMultipartContent(new Content[]{
72 new PlainTextContent(text),
73 new TextContent("x-aol",aol),
74 }) );
75 ModelHome.send(mail);
76 } catch(MailException e) {
77 throw new RuntimeException(e);
78 }
79 }
80
81 }
82 %>