1 17 18 package org.sape.carbon.services.email; 19 20 21 import java.util.HashMap ; 22 import java.util.Map ; 23 24 import org.sape.carbon.services.email.util.MailAttachment; 25 import org.sape.carbon.services.email.util.MailContentTypeEnum; 26 27 37 public class MailDataObject { 38 39 43 private HashMap toMap; 44 45 46 50 private HashMap ccMap; 51 52 53 57 private HashMap bccMap; 58 59 60 64 private HashMap headers; 65 66 67 70 private String fromEmail; 71 72 73 76 private String fromPersonal; 77 78 79 82 private String subject; 83 84 85 88 private String body; 89 90 91 94 private String charset; 95 96 97 100 private MailContentTypeEnum bodyType; 101 102 103 107 private MailAttachment[] attachments; 108 109 110 113 public MailDataObject() { 114 115 toMap = new HashMap (); 116 ccMap = new HashMap (); 117 bccMap = new HashMap (); 118 headers = new HashMap (); 119 } 120 121 122 128 public void addTo(String toEmail, String toPersonal) { 129 130 this.toMap.put(toEmail, toPersonal); 131 } 132 133 134 141 public void addTo(Map toMap) { 142 143 this.toMap.putAll(toMap); 144 } 145 146 147 153 public void addCC(String ccEmail, String ccPersonal) { 154 155 this.ccMap.put(ccEmail, ccPersonal); 156 } 157 158 159 166 public void addCC(Map ccMap) { 167 168 this.ccMap.putAll(ccMap); 169 } 170 171 172 179 public void addBCC(String bccEmail, String bccPersonal) { 180 181 this.bccMap.put(bccEmail, bccPersonal); 182 } 183 184 185 192 public void addBCC(Map bccMap) { 193 194 this.bccMap.putAll(bccMap); 195 } 196 197 198 204 public void setFrom(String fromEmail, String fromPersonal) { 205 206 this.fromEmail = fromEmail; 207 this.fromPersonal = fromPersonal; 208 } 209 210 211 216 public void setSubject(String subject) { 217 218 this.subject = subject; 219 } 220 221 222 228 public void setBody(String body, MailContentTypeEnum bodyType) { 229 230 this.body = body; 231 this.bodyType = bodyType; 232 } 233 234 235 240 public void setCharset(String charset) { 241 242 this.charset = charset; 243 } 244 245 246 252 public void addHeader(String headerName, String headerValue) { 253 254 this.headers.put(headerName, headerValue); 255 } 256 257 258 263 public void addHeader(Map headers) { 264 265 this.headers.putAll(headers); 266 } 267 268 269 275 public void setAttachments(MailAttachment[] attachments) { 276 277 this.attachments = attachments; 278 } 279 280 281 286 public Map getToMap() { 287 288 return this.toMap; 289 } 290 291 292 297 public Map getCCMap() { 298 299 return this.ccMap; 300 } 301 302 303 308 public Map getBCCMap() { 309 310 return this.bccMap; 311 } 312 313 314 319 public Map getHeaders() { 320 321 return this.headers; 322 } 323 324 325 330 public String getFromName() { 331 332 return this.fromPersonal; 333 } 334 335 336 341 public String getFromEmail() { 342 343 return this.fromEmail; 344 } 345 346 347 352 public String getCharset() { 353 354 return this.charset; 355 } 356 357 358 363 public String getSubject() { 364 365 return this.subject; 366 } 367 368 369 374 public String getBody() { 375 376 return this.body; 377 } 378 379 380 385 public MailContentTypeEnum getBodyType() { 386 387 return this.bodyType; 388 } 389 390 391 396 public MailAttachment[] getAttachments() { 397 398 return this.attachments; 399 } 400 } 401 | Popular Tags |