Rev 3 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3 | daniel-mar | 1 | package de.viathinksoft.utils.mail.sender; |
2 | |||
3 | import javax.mail.MessagingException; |
||
4 | |||
5 | import de.viathinksoft.utils.mail.EMailAddress; |
||
6 | |||
7 | public class PlainTextMailSender extends RawMailSender { |
||
8 | |||
9 | // --- E-Mail-Adressobjekt benutzen (dekodiert automatisch den Punycode) |
||
10 | |||
9 | daniel-mar | 11 | public void setMailFrom(String mailFrom) { |
3 | daniel-mar | 12 | this.setMailFrom(new EMailAddress(mailFrom)); |
13 | } |
||
14 | |||
9 | daniel-mar | 15 | public void setMailFrom(EMailAddress mailFrom) { |
3 | daniel-mar | 16 | super.setMailFrom(mailFrom.getMailAddressPunycodedDomain()); |
17 | } |
||
18 | |||
9 | daniel-mar | 19 | public void setRecipient(String recipient) { |
3 | daniel-mar | 20 | this.setRecipient(new EMailAddress(recipient)); |
21 | } |
||
22 | |||
9 | daniel-mar | 23 | public void setRecipient(EMailAddress recipient) { |
3 | daniel-mar | 24 | super.setRecipient(recipient.getMailAddressPunycodedDomain()); |
25 | } |
||
26 | |||
27 | // --- PlainText Implementieren |
||
28 | |||
29 | private String message; |
||
30 | |||
31 | public String getMessage() { |
||
32 | return message; |
||
33 | } |
||
34 | |||
35 | public void setMessage(String message) { |
||
36 | this.message = message; |
||
37 | if (this.message == null) |
||
38 | this.message = ""; |
||
39 | } |
||
40 | |||
41 | protected void generateMailObject() throws MessagingException, |
||
42 | AuthentificateDataIncompleteException { |
||
43 | |||
44 | super.generateMailObject(); |
||
45 | |||
46 | msg.setContent(message, "text/plain"); |
||
47 | } |
||
48 | |||
49 | } |