1 16 17 package org.springframework.mail.javamail; 18 19 import java.util.Date ; 20 21 import javax.mail.MessagingException ; 22 import javax.mail.internet.MimeMessage ; 23 24 import org.springframework.mail.MailMessage; 25 import org.springframework.mail.MailParseException; 26 27 40 public class MimeMailMessage implements MailMessage { 41 42 private final MimeMessageHelper helper; 43 44 45 49 public MimeMailMessage(MimeMessageHelper mimeMessageHelper) { 50 this.helper = mimeMessageHelper; 51 } 52 53 57 public MimeMailMessage(MimeMessage mimeMessage) { 58 this.helper = new MimeMessageHelper(mimeMessage); 59 } 60 61 64 public final MimeMessageHelper getMimeMessageHelper() { 65 return this.helper; 66 } 67 68 71 public final MimeMessage getMimeMessage() { 72 return this.helper.getMimeMessage(); 73 } 74 75 76 public void setFrom(String from) throws MailParseException { 77 try { 78 this.helper.setFrom(from); 79 } 80 catch (MessagingException ex) { 81 throw new MailParseException(ex); 82 } 83 } 84 85 public void setReplyTo(String replyTo) throws MailParseException { 86 try { 87 this.helper.setReplyTo(replyTo); 88 } 89 catch (MessagingException ex) { 90 throw new MailParseException(ex); 91 } 92 } 93 94 public void setTo(String to) throws MailParseException { 95 try { 96 this.helper.setTo(to); 97 } 98 catch (MessagingException ex) { 99 throw new MailParseException(ex); 100 } 101 } 102 103 public void setTo(String [] to) throws MailParseException { 104 try { 105 this.helper.setTo(to); 106 } 107 catch (MessagingException ex) { 108 throw new MailParseException(ex); 109 } 110 } 111 112 public void setCc(String cc) throws MailParseException { 113 try { 114 this.helper.setCc(cc); 115 } 116 catch (MessagingException ex) { 117 throw new MailParseException(ex); 118 } 119 } 120 121 public void setCc(String [] cc) throws MailParseException { 122 try { 123 this.helper.setCc(cc); 124 } 125 catch (MessagingException ex) { 126 throw new MailParseException(ex); 127 } 128 } 129 130 public void setBcc(String bcc) throws MailParseException { 131 try { 132 this.helper.setBcc(bcc); 133 } 134 catch (MessagingException ex) { 135 throw new MailParseException(ex); 136 } 137 } 138 139 public void setBcc(String [] bcc) throws MailParseException { 140 try { 141 this.helper.setBcc(bcc); 142 } 143 catch (MessagingException ex) { 144 throw new MailParseException(ex); 145 } 146 } 147 148 public void setSentDate(Date sentDate) throws MailParseException { 149 try { 150 this.helper.setSentDate(sentDate); 151 } 152 catch (MessagingException ex) { 153 throw new MailParseException(ex); 154 } 155 } 156 157 public void setSubject(String subject) throws MailParseException { 158 try { 159 this.helper.setSubject(subject); 160 } 161 catch (MessagingException ex) { 162 throw new MailParseException(ex); 163 } 164 } 165 166 public void setText(String text) throws MailParseException { 167 try { 168 this.helper.setText(text); 169 } 170 catch (MessagingException ex) { 171 throw new MailParseException(ex); 172 } 173 } 174 175 } 176 | Popular Tags |