public abstract class MailTransport
extends java.lang.Object
MailTransport - Provides operations related to a mail transport.| Constructor and Description |
|---|
MailTransport() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
close()
Closes this mail transport
|
static MailTransport |
getInstance(com.openexchange.session.Session session)
Gets the proper instance of
mail transport parameterized with given session. |
static MailTransport |
getInstance(com.openexchange.session.Session session,
int accountId)
Gets the proper instance of
mail transport for specified transport account. |
abstract TransportConfig |
getTransportConfig()
Returns the transport configuration appropriate for current user.
|
abstract void |
ping()
Pings the transport server to check if a connection can be established.
|
MailMessage |
sendMailMessage(ComposedMailMessage transportMail,
ComposeType sendType)
Sends a mail message
This is a convenience method that invokes
sendMailMessage(ComposedMailMessage, ComposeType, Address[]) with the latter
parameter set to null if ComposedMailMessage.hasRecipients() is false; otherwise
ComposedMailMessage.getRecipients() is passed. |
abstract MailMessage |
sendMailMessage(ComposedMailMessage transportMail,
ComposeType sendType,
javax.mail.Address[] allRecipients)
Sends a mail message
|
MailMessage |
sendRawMessage(byte[] asciiBytes)
Sends specified message's raw ascii bytes.
|
abstract MailMessage |
sendRawMessage(byte[] asciiBytes,
javax.mail.Address[] allRecipients)
Sends specified message's raw ascii bytes.
|
abstract void |
sendReceiptAck(MailMessage srcMail,
java.lang.String fromAddr)
Sends a receipt acknowledgment for the specified message.
|
public static final MailTransport getInstance(com.openexchange.session.Session session) throws com.openexchange.exception.OXException
mail transport parameterized with given session.
Note: Don't forget to call final close() on obtained mail transport:
final MailTransport mailTransport = MailTransport.getInstance(session);
try {
// Do something
} finally {
mailTransport.close();
}
session - The sessionMailTransportcom.openexchange.exception.OXException - If instantiation failspublic static final MailTransport getInstance(com.openexchange.session.Session session, int accountId) throws com.openexchange.exception.OXException
mail transport for specified transport account.
Note: Don't forget to call final close() on obtained mail transport:
final MailTransport mailTransport = MailTransport.getInstance(session, accountId);
try {
// Do something
} finally {
mailTransport.close();
}
session - The sessionaccountId - The account identifierMailTransportcom.openexchange.exception.OXException - If instantiation failspublic MailMessage sendMailMessage(ComposedMailMessage transportMail, ComposeType sendType) throws com.openexchange.exception.OXException
This is a convenience method that invokes sendMailMessage(ComposedMailMessage, ComposeType, Address[]) with the latter
parameter set to null if ComposedMailMessage.hasRecipients() is false; otherwise
ComposedMailMessage.getRecipients() is passed.
transportMail - The mail message to send (containing necessary header data and body)sendType - The send typecom.openexchange.exception.OXException - If transport failspublic abstract MailMessage sendMailMessage(ComposedMailMessage transportMail, ComposeType sendType, javax.mail.Address[] allRecipients) throws com.openexchange.exception.OXException
transportMail - The mail message to send (containing necessary header data and body)sendType - The send typeallRecipients - An array of addresses to send this message to; may be null to extract recipients
from message headers TO, CC, BCC, and NEWSGROUPS.com.openexchange.exception.OXException - If transport failspublic MailMessage sendRawMessage(byte[] asciiBytes) throws com.openexchange.exception.OXException
This is a convenience method that invokes sendRawMessage(byte[], Address[]) with the latter parameter set to
null.
asciiBytes - The raw ascii bytescom.openexchange.exception.OXException - If sending failspublic abstract MailMessage sendRawMessage(byte[] asciiBytes, javax.mail.Address[] allRecipients) throws com.openexchange.exception.OXException
asciiBytes - The raw ascii bytesallRecipients - An array of addresses to send this message to; may be null to extract recipients
from message headers TO, CC, BCC, and NEWSGROUPS.com.openexchange.exception.OXException - If sending failspublic abstract void sendReceiptAck(MailMessage srcMail, java.lang.String fromAddr) throws com.openexchange.exception.OXException
srcMail - The source mailfromAddr - The from address (as unicode string). If set to null, user's default email address is used as value for
header Fromcom.openexchange.exception.OXException - If transport failspublic abstract void ping()
throws com.openexchange.exception.OXException
com.openexchange.exception.OXException - If the ping failspublic abstract void close()
throws com.openexchange.exception.OXException
com.openexchange.exception.OXException - If closing failspublic abstract TransportConfig getTransportConfig() throws com.openexchange.exception.OXException
com.openexchange.exception.OXException