java.lang.Object | +--javax.mail.Service | +--javax.mail.TransportKnown Direct Subclasses:
Transport(Session session, URLName url) Constructor. |
void | addTransportListener(TransportListener l) Add a listener for Transport events. |
void | notifyTransportListeners(int type, Address validSent, Address validUnsent, Address invalid, Message msg) Notify all TransportListeners. |
void | removeTransportListener(TransportListener l) Remove a listener for Transport events. |
static void | Send a message. |
static void | send(Message msg, Address addresses) Send the message to the specified addresses, ignoring any recipients specified in the message itself. |
void | sendMessage(Message msg, Address addresses) Send the Message to the specified list of addresses. |
public Transport(Session session, URLName url)
public void addTransportListener(TransportListener l)
protected void notifyTransportListeners(int type, Address validSent, Address validUnsent, Address invalid, Message msg)
public void removeTransportListener(TransportListener l)
public static void send(Message msg)
getAllRecipients
), using message transports appropriate to
each address. The send
method calls the
saveChanges
method on the message before sending it.
If any of the recipient addresses is detected to be invalid by the
Transport during message submission, a SendFailedException is thrown.
Clients can get more detail about the failure by examining the exception.
Whether or not the message is still sent succesfully to any valid
addresses depends on the Transport implementation. See
SendFailedException for more details. Note also that success does not
imply that the message was delivered to the ultimate recipient, as
failures may occur in later stages of delivery. Once a Transport
accepts a message for delivery to a recipient, failures that occur
later should be reported to the user via another mechanism, such as
returning the undeliverable message.
SendFailedException
- if the message could not be sent to
some or any of the recipients.public static void send(Message msg, Address addresses)
send
method calls
the saveChanges
method on the message before sending it.
SendFailedException
- if the message could not be sent to
some or any of the recipients.public void sendMessage(Message msg, Address addresses)
send
method, the sendMessage
method does not call the saveChanges
method on the message;
the caller should do so.
SendFailedException
- if the send failed because of
invalid addresses.MessagingException
- if the connection is dead
or not in the connected state