|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SK.gnome.dwarf.mail.mime.MimePartBuilder SK.gnome.dwarf.mail.mime.MimeMessageBuilder
Provides a helper class to build MIME messages.
This class may be used to construct a MIME mail message, which can be sent over the network or stored to an external file. Both single and multipart messages are supported.
Field Summary |
Fields inherited from class SK.gnome.dwarf.mail.mime.MimePartBuilder |
allow8bit, DEFAULT_CHARSET, charset |
Constructor Summary | |
MimeMessageBuilder()
Creates a new MimeMessageBuilder. |
|
MimeMessageBuilder(boolean allow8bit)
Creates a new MimeMessageBuilder with 8bit transfer enabled. |
|
MimeMessageBuilder(boolean allow8bit,
java.lang.String charset)
Creates a new MimeMessageBuilder. |
|
MimeMessageBuilder(java.lang.String charset)
Creates a new MimeMessageBuilder with the given charset. |
Method Summary | |
java.util.Collection |
getRecipients()
Returns a collection of all recipient addresses. |
void |
setCc(java.lang.String addresses)
Sets the "Cc" header. |
void |
setCc(java.lang.String[] addresses)
Sets the "Cc" header. |
void |
setDate(java.util.Date date)
Sets the "Date" header. |
void |
setFrom(java.lang.String address)
Sets the "From" header. |
java.lang.String |
setMessageId(java.lang.String hostname)
Sets the "Message-Id" header. |
void |
setReplyTo(java.lang.String addresses)
Sets the "Reply-To" header. |
void |
setReplyTo(java.lang.String[] addresses)
Sets the "Reply-To" header. |
void |
setSender(java.lang.String address)
Sets the "Sender" header. |
void |
setSubject(java.lang.String subject)
Sets the "Subject" header. |
void |
setTo(java.lang.String addresses)
Sets the "To" header. |
void |
setTo(java.lang.String[] addresses)
Sets the "To" header. |
Methods inherited from class SK.gnome.dwarf.mail.mime.MimePartBuilder |
addHeader, addMimePart, getContentInputStream, getContentSize, getDecodedInputStream, getHeader, getHeader, getHeaderLines, getHeaderNames, getLineCount, getMatchingHeaderLines, getMimePart, getMimePartCount, getNonMatchingHeaderLines, getRawInputStream, getRawSize, isMimeType, removeHeader, removeMimePart, setAddressHeader, setAddressHeader, setContent, setContent, setContent, setContentDescription, setContentLanguage, setContentTransferEncoding, setContentType, setHeader, setName, writeTo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MimeMessageBuilder() throws java.io.IOException, MailException
It calls MimeMessageBuilder(boolean, String)
with false and
MimePartBuilder.DEFAULT_CHARSET
default values.
public MimeMessageBuilder(boolean allow8bit) throws java.io.IOException, MailException
If the allow8bit parameter is true, the message will be created assuming that the target MTA is capable to transfer 8bit content. If it is false, the message content will be always converted to pure 7bit ASCII format.
It calls MimeMessageBuilder(boolean, String)
with allow8bit and
MimePartBuilder.DEFAULT_CHARSET
values.
allow8bit
- whether to enable 8bit contentpublic MimeMessageBuilder(java.lang.String charset) throws java.io.IOException, MailException
The charset parameter specifies the MIME charset used to encode the headers as per RFC 2047.
It calls MimeMessageBuilder(boolean, String)
with false and
charset values.
charset
- the MIME charsetpublic MimeMessageBuilder(boolean allow8bit, java.lang.String charset) throws java.io.IOException, MailException
If the allow8bit parameter is true, the message will be created assuming that the target MTA is capable to transfer 8bit content. If it is false, the content will be always converted to pure 7bit ASCII format.
The charset parameter specifies the MIME charset used to encode the headers as per RFC 2047.
This constructor sets the "Date" header to the current system time, the "MIME-Version" header to "1.0" and the "Message-Id" header to an internally generated message id using the actual local host name. The "Date" and "Message-Id" headers may be changed later via the corresponding setter methods.
allow8bit
- whether to enable 8bit contentcharset
- the MIME charsetMethod Detail |
public void setCc(java.lang.String addresses) throws MailException
addresses
- comma-separated list of addresses
MailException
- if an error occuredpublic void setCc(java.lang.String[] addresses) throws MailException
addresses
- the array of addresses
MailException
- if an error occuredpublic void setDate(java.util.Date date) throws MailException
date
- the sent date
MailException
- if an error occuredpublic void setFrom(java.lang.String address) throws MailException
address
- the sender's address
MailException
- if an error occuredpublic java.lang.String setMessageId(java.lang.String hostname) throws MailException
The hostname parameter should reflect the actual hostname used by the mail server. You can use the "localhost" name if the server's name is not known for any reason.
hostname
- the actual hostname
MailException
- if an error occuredpublic void setReplyTo(java.lang.String addresses) throws MailException
addresses
- comma-separated list of addresses
MailException
- if an error occuredpublic void setReplyTo(java.lang.String[] addresses) throws MailException
addresses
- the array of addresses
MailException
- if an error occuredpublic void setSender(java.lang.String address) throws MailException
address
- the sender's address
MailException
- if an error occuredpublic void setSubject(java.lang.String subject) throws MailException
subject
- the message subject
MailException
- if an error occuredpublic void setTo(java.lang.String addresses) throws MailException
addresses
- comma-separated list of addresses
MailException
- if an error occuredpublic void setTo(java.lang.String[] addresses) throws MailException
addresses
- the array of addresses
MailException
- if an error occuredpublic java.util.Collection getRecipients() throws MailException
This method collects together all recipient addresses from the "To" and "Cc" headers and returns them in a new collection. The returned collection contains only internet addresses without the personal names.
MailException
- if an error occured
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |