org.apache.mailet
Interface Mail


public abstract interface Mail
extends java.io.Serializable, java.lang.Cloneable

Wrap a MimeMessage with routing information (from SMTP) such as SMTP specified recipients, sender, and ip address and hostname of sending server. It also contains its state which represents which processor in the mailet container it is currently running. Special processor names are "root" and "error".

Version:
0.9
Author:
Federico Barbieri , Serge Knystautas

Field Summary
static java.lang.String DEFAULT
           
static java.lang.String ERROR
           
static java.lang.String GHOST
           
static java.lang.String TRANSPORT
           
 
Fields inherited from class java.io.Serializable
serialVersionUID
 
Method Summary
 java.lang.String getErrorMessage()
          The error message, if any, associated with this message.
 javax.mail.internet.MimeMessage getMessage()
          Returns the MimeMessage stored in this message
 java.util.Collection getRecipients()
          Returns a Collection of MailAddress objects that are recipients of this message
 java.lang.String getRemoteAddr()
          The remote ip address of the server that connected to send this message
 java.lang.String getRemoteHost()
          The remote hostname of the server that connected to send this message
 MailAddress getSender()
          The sender of the message, as specified by the MAIL FROM header, or internally defined
 java.lang.String getState()
          The current state of the message, such as GHOST, ERROR, or DEFAULT
 void setErrorMessage(java.lang.String msg)
          Sets the error message associated with this message.
 void setMessage(java.io.InputStream in)
          Sets the MimeMessage associated with this message via an inputstream.
 void setMessage(javax.mail.internet.MimeMessage message)
          Sets the MimeMessage associated with this message via the object.
 void setState(java.lang.String state)
          Sets the state of this message.
 void writeContentTo(java.io.OutputStream out, int lines)
          Dumps X many number of lines from this message to an output stream
 void writeMessageTo(java.io.OutputStream out)
          Dumps this message to an output stream
 

Field Detail

GHOST

public static final java.lang.String GHOST

DEFAULT

public static final java.lang.String DEFAULT

ERROR

public static final java.lang.String ERROR

TRANSPORT

public static final java.lang.String TRANSPORT
Method Detail

getMessage

public javax.mail.internet.MimeMessage getMessage()
                                           throws javax.mail.MessagingException
Returns the MimeMessage stored in this message
Returns:
the MimeMessage that this Mail object wraps
Throws:
javax.mail.MessagingException - - an error occured while loading this object

getRecipients

public java.util.Collection getRecipients()
Returns a Collection of MailAddress objects that are recipients of this message
Returns:
a Collection of MailAddress objects that are recipients of this message

getSender

public MailAddress getSender()
The sender of the message, as specified by the MAIL FROM header, or internally defined
Returns:
a MailAddress of the sender of this message

getState

public java.lang.String getState()
The current state of the message, such as GHOST, ERROR, or DEFAULT
Returns:
the state of this message

getRemoteHost

public java.lang.String getRemoteHost()
The remote hostname of the server that connected to send this message
Returns:
a String of the hostname of the server that connected to send this message

getRemoteAddr

public java.lang.String getRemoteAddr()
The remote ip address of the server that connected to send this message
Returns:
a String of the ip address of the server that connected to send this message

getErrorMessage

public java.lang.String getErrorMessage()
The error message, if any, associated with this message. Not sure why this is needed.
Returns:
a String of a descriptive error message

setErrorMessage

public void setErrorMessage(java.lang.String msg)
Sets the error message associated with this message. Not sure why this is needed.
Parameters:
msg - - a descriptive error message

setMessage

public void setMessage(java.io.InputStream in)
                throws javax.mail.MessagingException
Sets the MimeMessage associated with this message via an inputstream. The Mail object will parse out the inputstream and construct a MimeMessage object.
Parameters:
in - - the inputstream to read to construct the MimeMessage
Throws:
javax.mail.MessagingException - - if there was an error parsing the inputstream

setMessage

public void setMessage(javax.mail.internet.MimeMessage message)
Sets the MimeMessage associated with this message via the object.
Parameters:
message - - the new MimeMessage that this Mail object will wrap

setState

public void setState(java.lang.String state)
Sets the state of this message.
Parameters:
state - - the new state of this message

writeMessageTo

public void writeMessageTo(java.io.OutputStream out)
                    throws java.io.IOException,
                           javax.mail.MessagingException
Dumps this message to an output stream
Parameters:
out - - the outputstream to send the MimeMessage headers and body content

writeContentTo

public void writeContentTo(java.io.OutputStream out,
                           int lines)
                    throws java.io.IOException,
                           javax.mail.MessagingException
Dumps X many number of lines from this message to an output stream
Parameters:
out - - the outputstream to send the MimeMessage headers and body content
lines - - the number of lines to return of the message