|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.james.core.MailImpl
Wraps a MimeMessage adding routing information (from SMTP) and some simple API enhancements.
Field Summary | |
static long |
serialVersionUID
We hardcode the serialVersionUID so that from James 1.2 on, MailImpl will be deserializable (so your mail doesn't get lost) |
Fields inherited from interface org.apache.mailet.Mail |
DEFAULT, ERROR, GHOST, TRANSPORT |
Constructor Summary | |
MailImpl()
A constructor that creates a new, uninitialized MailImpl |
|
MailImpl(MimeMessage message)
A constructor which will attempt to obtain sender and recipients from the headers of the MimeMessage supplied. |
|
MailImpl(String name,
MailAddress sender,
Collection recipients)
A constructor that creates a MailImpl with the specified name, sender, and recipients. |
|
MailImpl(String name,
MailAddress sender,
Collection recipients,
InputStream messageIn)
A constructor that creates a MailImpl with the specified name, sender, recipients, and message data. |
|
MailImpl(String name,
MailAddress sender,
Collection recipients,
MimeMessage message)
A constructor that creates a MailImpl with the specified name, sender, recipients, and MimeMessage. |
Method Summary | |
Mail |
bounce(String bounceText)
Generates a bounce mail that is a bounce of the original message. |
void |
dispose()
|
Mail |
duplicate()
Duplicate the MailImpl. |
Mail |
duplicate(String newName)
Duplicate the MailImpl, replacing the mail name with the one passed in as an argument. |
String |
getErrorMessage()
Get the error message associated with this MailImpl. |
Date |
getLastUpdated()
Get the last updated time for this MailImpl. |
MimeMessage |
getMessage()
Get the MimeMessage associated with this MailImpl. |
long |
getMessageSize()
Return the size of the message including its headers. |
String |
getName()
Get the name of this MailImpl. |
Collection |
getRecipients()
Get the recipients of this MailImpl. |
String |
getRemoteAddr()
Get the remote address associated with this MailImpl. |
String |
getRemoteHost()
Get the remote host associated with this MailImpl. |
MailAddress |
getSender()
Get the sender of this MailImpl. |
String |
getState()
Get the state of this MailImpl. |
void |
setErrorMessage(String msg)
Set the error message associated with this MailImpl. |
void |
setLastUpdated(Date lastUpdated)
Set the date this mail was last updated. |
void |
setMessage(MimeMessage message)
Set the MimeMessage associated with this MailImpl. |
void |
setName(String name)
Set the name of this MailImpl. |
void |
setRecipients(Collection recipients)
Set the recipients for this MailImpl. |
void |
setRemoteAddr(String remoteAddr)
Set the remote address associated with this MailImpl. |
void |
setRemoteHost(String remoteHost)
Set the remote address associated with this MailImpl. |
void |
setSender(MailAddress sender)
Set the sender of this MailImpl. |
void |
setState(String state)
Set the state of this MailImpl. |
void |
writeContentTo(OutputStream out,
int lines)
Writes the content of the message, up to a total number of lines, out to an OutputStream. |
void |
writeMessageTo(OutputStream out)
Writes the message out to an OutputStream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final long serialVersionUID
Constructor Detail |
public MailImpl()
public MailImpl(String name, MailAddress sender, Collection recipients)
name
- the name of the MailImplsender
- the sender for this MailImplrecipients
- the collection of recipients of this MailImplpublic MailImpl(String name, MailAddress sender, Collection recipients, InputStream messageIn) throws MessagingException
name
- the name of the MailImplsender
- the sender for this MailImplrecipients
- the collection of recipients of this MailImplmessageIn
- a stream containing the message sourcepublic MailImpl(String name, MailAddress sender, Collection recipients, MimeMessage message)
name
- the name of the MailImplsender
- the sender for this MailImplrecipients
- the collection of recipients of this MailImplmessage
- the MimeMessage associated with this MailImplpublic MailImpl(MimeMessage message) throws MessagingException
message
- - a MimeMessage from which to construct a MailMethod Detail |
public Mail duplicate()
public Mail duplicate(String newName)
newName
- the name for the duplicated mail
public String getErrorMessage()
getErrorMessage
in interface Mail
public MimeMessage getMessage() throws MessagingException
getMessage
in interface Mail
MessagingException
- - an error occured while loading this objectpublic void setName(String name)
name
- the name of this MailImplpublic String getName()
public Collection getRecipients()
getRecipients
in interface Mail
public MailAddress getSender()
getSender
in interface Mail
public String getState()
getState
in interface Mail
public String getRemoteHost()
getRemoteHost
in interface Mail
public String getRemoteAddr()
getRemoteAddr
in interface Mail
public Date getLastUpdated()
public long getMessageSize() throws 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().
MessagingException
- if a problem occurs while computing the message sizepublic void setErrorMessage(String msg)
setErrorMessage
in interface Mail
msg
- the new error message associated with this MailImplpublic void setMessage(MimeMessage message)
setMessage
in interface Mail
message
- the new MimeMessage associated with this MailImplpublic void setRecipients(Collection recipients)
recipients
- the recipients for this MailImplpublic void setSender(MailAddress sender)
sender
- the sender of this MailImplpublic void setState(String state)
setState
in interface Mail
state
- the state of this MailImplpublic void setRemoteHost(String remoteHost)
remoteHost
- the new remote host associated with this MailImplpublic void setRemoteAddr(String remoteAddr)
remoteAddr
- the new remote address associated with this MailImplpublic void setLastUpdated(Date lastUpdated)
lastUpdated
- the date the mail was last updatedpublic void writeMessageTo(OutputStream out) throws IOException, MessagingException
out
- the OutputStream to which to write the content
MessagingException
- if the MimeMessage is not set for this MailImpl
IOException
- if an error occurs while reading or writing from the streampublic Mail bounce(String bounceText) throws MessagingException
bounceText
- the text to be prepended to the message to describe the bounce condition
MessagingException
- if the bounce mail could not be createdpublic void writeContentTo(OutputStream out, int lines) throws IOException, MessagingException
out
- the OutputStream to which to write the contentlines
- the number of lines to write to the stream
MessagingException
- if the MimeMessage is not set for this MailImpl
IOException
- if an error occurs while reading or writing from the streampublic void dispose()
dispose
in interface Disposable
Disposable.dispose()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |