Mercurial Hosting > nabble
comparison src/nabble/view/lib/SubscribeDefaultsMail.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 java.io.PrintWriter; | |
5 import java.io.StringWriter; | |
6 import java.util.Date; | |
7 import fschmidt.util.mail.Mail; | |
8 import fschmidt.util.mail.MailException; | |
9 import fschmidt.util.mail.MailHome; | |
10 import fschmidt.util.mail.MailAddress; | |
11 import fschmidt.util.mail.PlainTextContent; | |
12 import nabble.model.MailingList; | |
13 import nabble.model.ModelHome; | |
14 | |
15 | |
16 public final class SubscribeDefaultsMail { | |
17 | |
18 public static Mail newMail(String email, MailingList mailingList, String url) { | |
19 StringWriter content = new StringWriter(); | |
20 PrintWriter out = new PrintWriter(content); | |
21 %> | |
22 Dear Nabble user: | |
23 | |
24 After your subscription request to <%=mailingList.getListAddress()%> has been accepted, | |
25 please follow the link below to turn off list mail delivery to your email address: | |
26 | |
27 <%=url%> | |
28 | |
29 Regards, | |
30 The Nabble Team | |
31 <% | |
32 out.close(); | |
33 try { | |
34 Mail mail = MailHome.newMail(); | |
35 mail.setFrom( new MailAddress(ModelHome.noReply) ); | |
36 mail.setTo( new MailAddress(email) ); | |
37 mail.setSubject( "Mailing list subscription settings" ); | |
38 mail.setContent( new PlainTextContent(content.toString()) ); | |
39 mail.setSentDate( new Date() ); | |
40 return mail; | |
41 } catch(MailException e) { | |
42 throw new RuntimeException(e); | |
43 } | |
44 } | |
45 | |
46 } | |
47 %> |