FileDocCategorySizeDatePackage
Mail.javaAPI DocApache James 2.3.18100Fri Jan 12 12:56:34 GMT 2007org.apache.mailet

Mail

public interface Mail implements Serializable, 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
CVS $Revision: 494012 $ $Date: 2007-01-08 11:23:58 +0100 (Mo, 08 Jan 2007) $

Fields Summary
String
GHOST
String
DEFAULT
String
ERROR
String
TRANSPORT
Constructors Summary
Methods Summary
public java.io.SerializablegetAttribute(java.lang.String name)
Returns the Mail session attribute with the given name, or null if there is no attribute by that name. An attribute allows a mailet to give this Mail instance additional information not already provided by this interface.

A list of currently set attributes can be retrieved using getAttributeNames.

The attribute is returned as a java.lang.Object or some subclass. Attribute names should follow the same convention as package names. The Mailet API specification reserves names matching org.apache.james.* and org.apache.mailet.*.

param
name - a String specifying the name of the attribute
return
an Object containing the value of the attribute, or null if no attribute exists matching the given name
since
Mailet API v2.1

public java.util.IteratorgetAttributeNames()
Returns an Iterator containing the attribute names currently available within this Mail instance. Use the getAttribute(java.lang.String) method with an attribute name to get the value of an attribute.

return
an Iterator of attribute names
since
Mailet API v2.1

public java.lang.StringgetErrorMessage()
The error message, if any, associated with this message. Not sure why this is needed.

return
a String of a descriptive error message

public java.util.DategetLastUpdated()

return
the last update date
since
Mailet API v2.3

public javax.mail.internet.MimeMessagegetMessage()
Returns the MimeMessage stored in this message

return
the MimeMessage that this Mail object wraps
throws
MessagingException - an error occured while loading this object

public longgetMessageSize()

return
message size
since
Mailet API v2.3

public java.lang.StringgetName()
Returns the message name of this message

return
the message name
since
Mailet API v2.3

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

return
a Collection of MailAddress objects that are recipients of this message

public java.lang.StringgetRemoteAddr()
The remote ip address of the server that connected to send this message

return
a String of the ip address of the server that connected to send this message

public java.lang.StringgetRemoteHost()
The remote hostname of the server that connected to send this message

return
a String of the hostname of the server that connected to send this message

public MailAddressgetSender()
The sender of the message, as specified by the MAIL FROM header, or internally defined

return
a MailAddress of the sender of this message

public java.lang.StringgetState()
The current state of the message, such as GHOST, ERROR, or DEFAULT

return
the state of this message

public booleanhasAttributes()

return
true if this Mail instance has any attributes set.
since
Mailet API v2.1

public voidremoveAllAttributes()
Removes all the attributes associated with this Mail instance.

since
Mailet API v2.1

public java.io.SerializableremoveAttribute(java.lang.String name)
Removes the attribute with the given name from this Mail instance. After removal, subsequent calls to getAttribute(java.lang.String) to retrieve the attribute's value will return null.

param
name - a String specifying the name of the attribute to be removed
return
previous attribute value associated with specified name, or null if there was no mapping for name (null can also mean that null was bound to the name)
since
Mailet API v2.1

public java.io.SerializablesetAttribute(java.lang.String name, java.io.Serializable object)
Binds an object to a given attribute name in this Mail instance. If the name specified is already used for an attribute, this method will remove the old attribute and bind the name to the new attribute. As instances of Mail is Serializable, it is necessary that the attributes being Serializable as well

Attribute names should follow the same convention as package names. The Mailet API specification reserves names matching org.apache.james.* and org.apache.mailet.*.

param
name - a String specifying the name of the attribute
param
object - a Serializable Object representing the attribute to be bound
return
the object previously bound to the name, null if the name was not bound (null can also mean that null was bound to the name)
since
Mailet API v2.1

public voidsetErrorMessage(java.lang.String msg)
Sets the error message associated with this message. Not sure why this is needed.

param
msg - a descriptive error message

public voidsetLastUpdated(java.util.Date lastUpdated)

param
lastUpdated the new last updated date
since
Mailet API v2.3

public voidsetMessage(javax.mail.internet.MimeMessage message)
Sets the MimeMessage associated with this message via the object.

param
message - the new MimeMessage that this Mail object will wrap

public voidsetName(java.lang.String newName)
Set the message name of this message

param
newName new name
since
Mailet API v2.3

public voidsetRecipients(java.util.Collection recipients)
Method setRecipients.

param
recipients a Collection of MailAddress Objects representing the recipients of this message
since
Mailet API v3.0-unstable

public voidsetState(java.lang.String state)
Sets the state of this message.

param
state - the new state of this message