Mercurial Hosting > nabble
comparison src/nabble/view/lib/SubscribeDefaultsMail.java @ 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 out.print( "\nDear Nabble user:\n\nAfter your subscription request to " ); | |
23 out.print( (mailingList.getListAddress()) ); | |
24 out.print( " has been accepted,\nplease follow the link below to turn off list mail delivery to your email address:\n\n" ); | |
25 out.print( (url) ); | |
26 out.print( "\n\nRegards,\nThe Nabble Team\n" ); | |
27 | |
28 out.close(); | |
29 try { | |
30 Mail mail = MailHome.newMail(); | |
31 mail.setFrom( new MailAddress(ModelHome.noReply) ); | |
32 mail.setTo( new MailAddress(email) ); | |
33 mail.setSubject( "Mailing list subscription settings" ); | |
34 mail.setContent( new PlainTextContent(content.toString()) ); | |
35 mail.setSentDate( new Date() ); | |
36 return mail; | |
37 } catch(MailException e) { | |
38 throw new RuntimeException(e); | |
39 } | |
40 } | |
41 | |
42 } | |
43 |