org.deegree.commons.mail
Class EMailMessage

java.lang.Object
  extended by org.deegree.commons.mail.EMailMessage
All Implemented Interfaces:
Serializable, MailMessage

public class EMailMessage
extends Object
implements Serializable, MailMessage

This class encapsulates all the info need to send an email message. This object is passed to the MailerEJB sendMail(...) method.

Version:
$Revision: 30119 $,$Date: 2011-03-22 10:02:35 +0100 (Tue, 22 Mar 2011) $
Author:
Torsten Friebe, last edited by: $Author: aschmitz $
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.deegree.commons.mail.MailMessage
PART_INLINE, PART_REF, PLAIN_TEXT, TEXT_HTML, TEXT_XML
 
Constructor Summary
EMailMessage(String from, String to, String subject, String messageBody)
          Creates a new mail message with MIME type text/plain.
EMailMessage(String from, String to, String subject, String messageBody, String mimeType)
          Creates a new mail message with the given MIME type.
 
Method Summary
 String getHeader()
          Return mail header including sender, receiver and subject.
 String getMessageBody()
          Method declaration
 String getMimeType()
          Gets the mimeType attribute of the EMailMessage object
 String getReceiver()
          Method declaration
 String getSender()
          Method declaration
 String getSubject()
          Gets the subject attribute of the EMailMessage object
 boolean isValid()
          Returns the state of this message.
 void setMessageBody(String message)
          Method declaration
 void setMimeType(String mimeType)
          Sets the mimeType attribute of the EMailMessage object
 void setReceiver(String to)
          Method declaration
 void setSender(String from)
          Method declaration
 void setSubject(String title)
          Method declaration
 String toString()
          Description of the Method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EMailMessage

public EMailMessage(String from,
                    String to,
                    String subject,
                    String messageBody)
Creates a new mail message with MIME type text/plain.

Parameters:
from - the sender
to - the receiver list
subject - the subject
messageBody - the content of the message

EMailMessage

public EMailMessage(String from,
                    String to,
                    String subject,
                    String messageBody,
                    String mimeType)
             throws UnknownMimeTypeException
Creates a new mail message with the given MIME type.

Parameters:
from - the sender
to - the receiver list
subject - the subject
messageBody - the content of the message
mimeType - the MIME type of the message body
Throws:
UnknownMimeTypeException - if the given mimeType is not supported
Method Detail

isValid

public boolean isValid()
Returns the state of this message. If sender and receiver are unequal null then this message is valid otherwise invalid.

Specified by:
isValid in interface MailMessage
Returns:
validation state, true if sender and receiver are not null, otherwise false

getHeader

public String getHeader()
Return mail header including sender, receiver and subject.

Specified by:
getHeader in interface MailMessage
Returns:
string with sender, receiver and subject

toString

public String toString()
Description of the Method

Overrides:
toString in class Object
Returns:
Description of the Return Value

getSender

public String getSender()
Method declaration

Specified by:
getSender in interface MailMessage
Returns:
sender

getMessageBody

public String getMessageBody()
Method declaration

Specified by:
getMessageBody in interface MailMessage
Returns:
The messageBody value

getReceiver

public String getReceiver()
Method declaration

Specified by:
getReceiver in interface MailMessage
Returns:
emailReceiver

setReceiver

public void setReceiver(String to)
Method declaration

Specified by:
setReceiver in interface MailMessage
Parameters:
to -

setMessageBody

public void setMessageBody(String message)
Method declaration

Specified by:
setMessageBody in interface MailMessage
Parameters:
message -

setSender

public void setSender(String from)
Method declaration

Specified by:
setSender in interface MailMessage
Parameters:
from -

setSubject

public void setSubject(String title)
Method declaration

Specified by:
setSubject in interface MailMessage
Parameters:
title -

getSubject

public String getSubject()
Gets the subject attribute of the EMailMessage object

Specified by:
getSubject in interface MailMessage
Returns:
The subject value

setMimeType

public void setMimeType(String mimeType)
                 throws UnknownMimeTypeException
Sets the mimeType attribute of the EMailMessage object

Specified by:
setMimeType in interface MailMessage
Parameters:
mimeType - The new mimeType value
Throws:
UnknownMimeTypeException - if the given MIME type is not supported
See Also:
MailMessage.PLAIN_TEXT, MailMessage.TEXT_HTML, IETF MIME RFC, Part.setContent(java.lang.Object, java.lang.String), Part.setText(java.lang.String)

getMimeType

public String getMimeType()
Gets the mimeType attribute of the EMailMessage object

Specified by:
getMimeType in interface MailMessage
Returns:
The mimeType value
See Also:
Part.getContentType()


Copyright © 2011. All Rights Reserved.