org.apache.james.core
Class MailImpl

java.lang.Object
  |
  +--org.apache.james.core.MailImpl
All Implemented Interfaces:
java.lang.Cloneable, Mail, java.io.Serializable

public class MailImpl
extends java.lang.Object
implements Mail

Wrap a MimeMessage adding routing informations (from SMTP) and same simple API.

Version:
0.9
Author:
Federico Barbieri , Serge Knystautas
See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Fields inherited from interface org.apache.mailet.Mail
DEFAULT, ERROR, GHOST, TRANSPORT
 
Constructor Summary
MailImpl()
           
MailImpl(java.lang.String name, MailAddress sender, java.util.Collection recipients)
           
MailImpl(java.lang.String name, MailAddress sender, java.util.Collection recipients, java.io.InputStream messageIn)
           
MailImpl(java.lang.String name, MailAddress sender, java.util.Collection recipients, javax.mail.internet.MimeMessage message)
           
 
Method Summary
 Mail bounce(java.lang.String message)
           
 void clean()
           
 Mail duplicate()
           
 Mail duplicate(java.lang.String newName)
           
 java.lang.String getErrorMessage()
          The error message, if any, associated with this message.
 java.util.Date getLastUpdated()
           
 javax.mail.internet.MimeMessage getMessage()
          Returns the MimeMessage stored in this message
 long getMessageSize()
          Return the size of the message including its headers.
 java.lang.String getName()
           
 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 setLastUpdated(java.util.Date lastUpdated)
           
 void setMessage(javax.mail.internet.MimeMessage message)
          Sets the MimeMessage associated with this message via the object.
 void setName(java.lang.String name)
           
 void setRecipients(java.util.Collection recipients)
           
 void setRemoteAddr(java.lang.String remoteAddr)
           
 void setRemoteHost(java.lang.String remoteHost)
           
 void setSender(MailAddress sender)
           
 void setState(java.lang.String state)
          Sets the state of this message.
 void writeContentTo(java.io.OutputStream out, int lines)
           
 void writeMessageTo(java.io.OutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Constructor Detail

MailImpl

public MailImpl()

MailImpl

public MailImpl(java.lang.String name,
                MailAddress sender,
                java.util.Collection recipients)

MailImpl

public MailImpl(java.lang.String name,
                MailAddress sender,
                java.util.Collection recipients,
                java.io.InputStream messageIn)
         throws javax.mail.MessagingException

MailImpl

public MailImpl(java.lang.String name,
                MailAddress sender,
                java.util.Collection recipients,
                javax.mail.internet.MimeMessage message)
Method Detail

clean

public void clean()

duplicate

public Mail duplicate()

duplicate

public Mail duplicate(java.lang.String newName)

getErrorMessage

public java.lang.String getErrorMessage()
Description copied from interface: Mail
The error message, if any, associated with this message. Not sure why this is needed.
Specified by:
getErrorMessage in interface Mail
Following copied from interface: org.apache.mailet.Mail
Returns:
a String of a descriptive error message

getMessage

public javax.mail.internet.MimeMessage getMessage()
                                           throws javax.mail.MessagingException
Description copied from interface: Mail
Returns the MimeMessage stored in this message
Specified by:
getMessage in interface Mail
Following copied from interface: org.apache.mailet.Mail
Returns:
the MimeMessage that this Mail object wraps
Throws:
javax.mail.MessagingException - - an error occured while loading this object

setName

public void setName(java.lang.String name)

getName

public java.lang.String getName()

getRecipients

public java.util.Collection getRecipients()
Description copied from interface: Mail
Returns a Collection of MailAddress objects that are recipients of this message
Specified by:
getRecipients in interface Mail
Following copied from interface: org.apache.mailet.Mail
Returns:
a Collection of MailAddress objects that are recipients of this message

getSender

public MailAddress getSender()
Description copied from interface: Mail
The sender of the message, as specified by the MAIL FROM header, or internally defined
Specified by:
getSender in interface Mail
Following copied from interface: org.apache.mailet.Mail
Returns:
a MailAddress of the sender of this message

getState

public java.lang.String getState()
Description copied from interface: Mail
The current state of the message, such as GHOST, ERROR, or DEFAULT
Specified by:
getState in interface Mail
Following copied from interface: org.apache.mailet.Mail
Returns:
the state of this message

getRemoteHost

public java.lang.String getRemoteHost()
Description copied from interface: Mail
The remote hostname of the server that connected to send this message
Specified by:
getRemoteHost in interface Mail
Following copied from interface: org.apache.mailet.Mail
Returns:
a String of the hostname of the server that connected to send this message

getRemoteAddr

public java.lang.String getRemoteAddr()
Description copied from interface: Mail
The remote ip address of the server that connected to send this message
Specified by:
getRemoteAddr in interface Mail
Following copied from interface: org.apache.mailet.Mail
Returns:
a String of the ip address of the server that connected to send this message

getLastUpdated

public java.util.Date getLastUpdated()

getMessageSize

public long getMessageSize()
                    throws javax.mail.MessagingException

Return the size of the message including its headers. MimeMessage.getSize() method only returns the size of the message body.

Note: this size is not guaranteed to be accurate - see Sun's documentation of MimeMessage.getSize().

Returns:
approximate size of full message including headers.

setErrorMessage

public void setErrorMessage(java.lang.String msg)
Description copied from interface: Mail
Sets the error message associated with this message. Not sure why this is needed.
Specified by:
setErrorMessage in interface Mail
Following copied from interface: org.apache.mailet.Mail
Parameters:
msg - - a descriptive error message

setMessage

public void setMessage(javax.mail.internet.MimeMessage message)
Description copied from interface: Mail
Sets the MimeMessage associated with this message via the object.
Specified by:
setMessage in interface Mail
Following copied from interface: org.apache.mailet.Mail
Parameters:
message - - the new MimeMessage that this Mail object will wrap

setRecipients

public void setRecipients(java.util.Collection recipients)

setSender

public void setSender(MailAddress sender)

setState

public void setState(java.lang.String state)
Description copied from interface: Mail
Sets the state of this message.
Specified by:
setState in interface Mail
Following copied from interface: org.apache.mailet.Mail
Parameters:
state - - the new state of this message

setRemoteHost

public void setRemoteHost(java.lang.String remoteHost)

setRemoteAddr

public void setRemoteAddr(java.lang.String remoteAddr)

setLastUpdated

public void setLastUpdated(java.util.Date lastUpdated)

writeMessageTo

public void writeMessageTo(java.io.OutputStream out)
                    throws java.io.IOException,
                           javax.mail.MessagingException

bounce

public Mail bounce(java.lang.String message)
            throws javax.mail.MessagingException

writeContentTo

public void writeContentTo(java.io.OutputStream out,
                           int lines)
                    throws java.io.IOException,
                           javax.mail.MessagingException


"Copyright © 2001 Apache Jakarta Project. All Rights Reserved."