|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--de.trantor.mail.Envelope
Represents an envelope used for sending a message via the SMTP protocol. The envelope holds information about a message's sender and recipients as used during an SMTP session. It serves more or less the same purpose that an envelope is used for when sending snail mail. Note that there is a difference between the message envelope and the message header.
Most of the time the envelope data will be identical to the "From:", "To:", "CC:" and "BCC:" fields of the message header. There are cases, though, where one might want to send a message to a recipient different from the one originally specified in the message. A mailing list is an example of an application that makes use of this feature: Postings are forwarded to the subscribers *without* changing the original message. This is one reason for separating the envelope from the message itself.
Another reason for separating the message from its envelope is memory savings: The envelope information in only needed while sending a message via SMTP. It is not required for receiving messages via POP3 or for holding messages in-memory.
Message,
SmtpClient| Constructor Summary | |
Envelope(Message message,
boolean autofill)
Creates a new envelope for a given message. |
|
| Method Summary | |
int |
addRecipient(java.lang.String address)
Adds a recipient to the message's envelope. |
Message |
getMessage()
Returns the message contained in this envelope. |
java.lang.String |
getRecipient(int index)
Returns one of the envelope's recipients by index. |
int |
getRecipientCount()
Returns the number of recipients specified in this envelope. |
java.lang.String |
getSender()
Returns the envelope's sender field. |
void |
removeRecipient(int index)
Removes a recipient from the message's envelope. |
void |
setRecipient(int index,
java.lang.String address)
Replaces the envelope's recipient at the given index by a new one. |
void |
setSender(java.lang.String address)
Sets the envelope's sender field to the given value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Envelope(Message message,
boolean autofill)
| Method Detail |
public Message getMessage()
public void setSender(java.lang.String address)
getSender(),
addRecipient(java.lang.String),
getRecipientCount(),
getRecipient(int),
setRecipient(int, java.lang.String),
removeRecipient(int)public java.lang.String getSender()
setSender(java.lang.String),
addRecipient(java.lang.String),
getRecipientCount(),
getRecipient(int),
setRecipient(int, java.lang.String),
removeRecipient(int)public int addRecipient(java.lang.String address)
getSender(),
setSender(java.lang.String),
getRecipientCount(),
getRecipient(int),
setRecipient(int, java.lang.String),
removeRecipient(int)
public void setRecipient(int index,
java.lang.String address)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsExceptiongetSender(),
setSender(java.lang.String),
addRecipient(java.lang.String),
getRecipientCount(),
getRecipient(int),
removeRecipient(int)public int getRecipientCount()
getSender(),
setSender(java.lang.String),
addRecipient(java.lang.String),
getRecipient(int),
setRecipient(int, java.lang.String),
removeRecipient(int)
public java.lang.String getRecipient(int index)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsExceptiongetSender(),
setSender(java.lang.String),
addRecipient(java.lang.String),
getRecipientCount(),
setRecipient(int, java.lang.String),
removeRecipient(int)
public void removeRecipient(int index)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsExceptiongetSender(),
setSender(java.lang.String),
addRecipient(java.lang.String),
getRecipientCount(),
getRecipient(int),
setRecipient(int, java.lang.String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||