Subversion Repositories javautils

Rev

Rev 3 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  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.        
  11.         public void setMailFrom(String mailFrom) {
  12.                 this.setMailFrom(new EMailAddress(mailFrom));
  13.         }
  14.  
  15.         public void setMailFrom(EMailAddress mailFrom) {
  16.                 super.setMailFrom(mailFrom.getMailAddressPunycodedDomain());
  17.         }
  18.  
  19.         public void setRecipient(String recipient) {
  20.                 this.setRecipient(new EMailAddress(recipient));
  21.         }
  22.  
  23.         public void setRecipient(EMailAddress recipient) {
  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. }
  50.