001: /*
002: * @author <a href="mailto:novotny@gridsphere.org">Jason Novotny</a>
003: * @version $Id: MailMessage.java 6385 2007-10-25 14:02:26Z wehrens $
004: */
005: package org.gridsphere.services.core.mail;
006:
007: /**
008: * The <code>MailMessage</code> utility class represents a mail message.
009: */
010: public class MailMessage {
011:
012: private String subject = "";
013: private String body = "";
014: private String emailAddress = "";
015: private String sender = "";
016: private String recType = TO;
017:
018: public static String TO = "to";
019: public static String BCC = "bcc";
020:
021: /**
022: * Constructs an empty mail message
023: */
024: public MailMessage() {
025: }
026:
027: /**
028: * Constructs a mail message given a subject, sender, body and email address
029: *
030: * @param subject the subject of the email
031: * @param body the body of the email
032: * @param emailAddress the recipient to mail job info to
033: * @param sender the reply-to of the mail
034: */
035: public MailMessage(String subject, String body,
036: String emailAddress, String sender) {
037: this .subject = subject;
038: this .body = body;
039: this .emailAddress = emailAddress;
040: this .sender = sender;
041: }
042:
043: /**
044: * Sets the email subject
045: *
046: * @param subject the email subject
047: */
048: public void setSubject(String subject) {
049: this .subject = subject;
050: }
051:
052: /**
053: * Returns the email subject
054: *
055: * @return the email subject
056: */
057: public String getSubject() {
058: return subject;
059: }
060:
061: /**
062: * Sets the email body
063: *
064: * @param body the email body
065: */
066: public void setBody(String body) {
067: this .body = body;
068: }
069:
070: /**
071: * Returns the email body
072: *
073: * @return the email boody
074: */
075: public String getBody() {
076: return body;
077: }
078:
079: /**
080: * Sets the email address
081: *
082: * @param emailAddress the email address
083: */
084: public void setEmailAddress(String emailAddress) {
085: this .emailAddress = emailAddress;
086: }
087:
088: /**
089: * Returns the email address
090: *
091: * @return the email address
092: */
093: public String getEmailAddress() {
094: return emailAddress;
095: }
096:
097: /**
098: * Sets the email sender
099: *
100: * @param sender the email sender
101: */
102: public void setSender(String sender) {
103: this .sender = sender;
104: }
105:
106: /**
107: * Returns the email sender
108: *
109: * @return the email sender
110: */
111: public String getSender() {
112: return sender;
113: }
114:
115: /**
116: * Return the recipient type either BCC or TO
117: *
118: * @return the recipient type
119: */
120: public String getRecipientType() {
121: return recType;
122: }
123:
124: /**
125: * Sets the recipient type
126: *
127: * @param recType the recipient type either BCC or TO
128: */
129: public void setRecipientType(String recType) {
130: this .recType = recType;
131: }
132:
133: public String toString() {
134: StringBuffer sb = new StringBuffer();
135: sb.append("\nsubject= ").append(subject);
136: sb.append("\nemailAddress= ").append(emailAddress);
137: sb.append("\nsender= ").append(sender);
138: sb.append("\nbody= ").append(body);
139: return sb.toString();
140: }
141: }
|