| java.lang.Object | |||
| ↳ | com.google.code.javax.mail.Message | ||
| ↳ | com.google.code.javax.mail.internet.MimeMessage | ||
| ↳ | com.google.code.com.sun.mail.smtp.SMTPMessage | ||
This class is a specialization of the MimeMessage class that allows you to specify various SMTP options and parameters that will be used when this message is sent over SMTP. Simply use this class instead of MimeMessage and set SMTP options using the methods on this class.
See the com.sun.mail.smtp package documentation for further information on the SMTP protocol provider.
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| int | NOTIFY_DELAY | Notify of delivery delay | |||||||||
| int | NOTIFY_FAILURE | Notify of delivery failure | |||||||||
| int | NOTIFY_NEVER | Never notify of delivery status | |||||||||
| int | NOTIFY_SUCCESS | Notify of delivery success | |||||||||
| int | RETURN_FULL | Return full message with delivery status notification | |||||||||
| int | RETURN_HDRS | Return only message headers with delivery status notification | |||||||||
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.google.code.javax.mail.Part
| |||||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| allow8bitMIME | |||||||||||
| envelopeFrom | |||||||||||
| extension | |||||||||||
| notifyOptions | |||||||||||
| returnOption | |||||||||||
| returnOptionString | |||||||||||
| sendPartial | |||||||||||
| submitter | |||||||||||
|
[Expand]
Inherited Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.code.javax.mail.internet.MimeMessage
| |||||||||||
From class
com.google.code.javax.mail.Message
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Default constructor.
| |||||||||||
Constructs an SMTPMessage by reading and parsing the data from the
specified MIME InputStream.
| |||||||||||
Constructs a new SMTPMessage with content initialized from the
source MimeMessage. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Is use of the 8BITMIME extension is allowed?
| |||||||||||
Return the envelope From address.
| |||||||||||
Gets the extension string to use with the MAIL command.
| |||||||||||
Get notification options.
| |||||||||||
Return return option.
| |||||||||||
Send message if some addresses are invalid?
| |||||||||||
Gets the submitter to be used for the RFC 2554 AUTH= value
in the MAIL FROM command.
| |||||||||||
If set to true, and the server supports the 8BITMIME extension, text
parts of this message that use the "quoted-printable" or "base64"
encodings are converted to use "8bit" encoding if they follow the
RFC 2045 rules for 8bit text.
| |||||||||||
Set the From address to appear in the SMTP envelope.
| |||||||||||
Set the extension string to use with the MAIL command.
| |||||||||||
Set notification options to be used if the server supports
Delivery Status Notification
(RFC 1891).
| |||||||||||
Set return option to be used if server supports
Delivery Status Notification
(RFC 1891).
| |||||||||||
If set to true, and this message has some valid and some invalid
addresses, send the message anyway, reporting the partial failure with
a SendFailedException.
| |||||||||||
Sets the submitter to be used for the RFC 2554 AUTH= value
in the MAIL FROM command.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.code.javax.mail.internet.MimeMessage
| |||||||||||
From class
com.google.code.javax.mail.Message
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.google.code.javax.mail.HasRawInputStream
| |||||||||||
From interface
com.google.code.javax.mail.Part
| |||||||||||
From interface
com.google.code.javax.mail.internet.MimePart
| |||||||||||
Notify of delivery delay
Notify of delivery failure
Never notify of delivery status
Notify of delivery success
Return full message with delivery status notification
Return only message headers with delivery status notification
Default constructor. An empty message object is created.
The headers field is set to an empty InternetHeaders
object. The flags field is set to an empty Flags
object. The modified flag is set to true.
| session |
|---|
Constructs an SMTPMessage by reading and parsing the data from the specified MIME InputStream. The InputStream will be left positioned at the end of the data for the message. Note that the input stream parse is done within this constructor itself.
| session | Session object for this message |
|---|---|
| is | The message input stream |
| MessagingException |
|---|
Constructs a new SMTPMessage with content initialized from the
source MimeMessage. The new message is independent
of the original.
Note: The current implementation is rather inefficient, copying the data more times than strictly necessary.
| source | The message to copy content from |
|---|
| MessagingException |
|---|
Is use of the 8BITMIME extension is allowed?
Return the envelope From address.
Gets the extension string to use with the MAIL command.
Get notification options. Returns zero if no options set.
Return return option. Returns zero if no option set.
Send message if some addresses are invalid?
Gets the submitter to be used for the RFC 2554 AUTH= value in the MAIL FROM command.
If set to true, and the server supports the 8BITMIME extension, text parts of this message that use the "quoted-printable" or "base64" encodings are converted to use "8bit" encoding if they follow the RFC 2045 rules for 8bit text.
If true, overrides the mail.smtp.allow8bitmime property.
| allow | Allow 8-bit flag |
|---|
Set the From address to appear in the SMTP envelope. Note that this is different than the From address that appears in the message itself. The envelope From address is typically used when reporting errors. See RFC 821 for details.
If set, overrides the mail.smtp.from property.
| from | The envelope From address |
|---|
Set the extension string to use with the MAIL command. The extension string can be used to specify standard SMTP service extensions as well as vendor-specific extensions. Typically the application should use the com.sun.mail.smtp.SMTPTransport SMTPTransport method com.sun.mail.smtp.SMTPTransport#supportsExtension supportsExtension to verify that the server supports the desired service extension. See RFC 1869 and other RFCs that define specific extensions.
For example:
if (smtpTransport.supportsExtension("DELIVERBY"))
smtpMsg.setMailExtension("BY=60;R");
| extension |
|---|
Set notification options to be used if the server supports
Delivery Status Notification
(RFC 1891).
Either NOTIFY_NEVER or some combination of
NOTIFY_SUCCESS, NOTIFY_FAILURE, and
NOTIFY_DELAY.
If set, overrides the mail.smtp.dsn.notify property.
| options | Notification options |
|---|
Set return option to be used if server supports
Delivery Status Notification
(RFC 1891).
Either RETURN_FULL or RETURN_HDRS.
If set, overrides the mail.smtp.dsn.ret property.
| option | Return option |
|---|
If set to true, and this message has some valid and some invalid addresses, send the message anyway, reporting the partial failure with a SendFailedException. If set to false (the default), the message is not sent to any of the recipients if there is an invalid recipient address.
If true, overrides the mail.smtp.sendpartial property.
| partial | Send partial flag |
|---|
Sets the submitter to be used for the RFC 2554 AUTH= value in the MAIL FROM command. Normally only used by a server that's relaying a message. Clients will typically not set a submitter. See RFC 2554 for details.
| submitter | The name of the submitter |
|---|