Note that Transport extends the Service
class, which provides many common methods for naming transports,
connecting to transports, and listening to connection events.
javax.mail.Service, javax.mail.event.ConnectionEvent, javax.mail.event.TransportEvent
| Modifier and Type | Field and Description |
|---|---|
| private volatile Vector |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | addTransportListener(TransportListener
the Listener for Transport events l)Add a listener for Transport events. |
| protected void | notifyTransportListeners(int
the TransportEvent type type, Address[] valid addresses to which message was sent validSent, Address[] valid addresses to which message was not sent validUnsent, Address[] the invalid addresses invalid, Message the message msg)Notify all TransportListeners. |
| public synchronized void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| private static void | |
| public abstract void | sendMessage(Message
The Message to be sent msg, Address[] array of addresses to send this message to addresses)Send the Message to the specified list of addresses. |
| transportListeners | back to summary |
|---|---|
| private volatile Vector<TransportListener> transportListeners | |
| Transport | back to summary |
|---|---|
| public Transport(Session session, URLName urlname) Constructor. | |
| addTransportListener | back to summary |
|---|---|
| public synchronized void addTransportListener(TransportListener l) Add a listener for Transport events. The default implementation provided here adds this listener to an internal list of TransportListeners.
| |
| notifyTransportListeners | back to summary |
|---|---|
| protected void notifyTransportListeners(int type, Address[] validSent, Address[] validUnsent, Address[] invalid, Message msg) Notify all TransportListeners. Transport implementations are expected to use this method to broadcast TransportEvents. The provided default implementation queues the event into an internal event queue. An event dispatcher thread dequeues events from the queue and dispatches them to the registered TransportListeners. Note that the event dispatching occurs in a separate thread, thus avoiding potential deadlock problems. | |
| removeTransportListener | back to summary |
|---|---|
| public synchronized void removeTransportListener(TransportListener l) Remove a listener for Transport events. The default implementation provided here removes this listener from the internal list of TransportListeners.
| |
| send | back to summary |
|---|---|
| public static void send(Message msg) throws MessagingException Send a message. The message will be sent to all recipient
addresses specified in the message (as returned from the
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 successfully 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. In typical usage, a SendFailedException reflects an error detected by the server. The details of the SendFailedException will usually contain the error message from the server (such as an SMTP error message). An address may be detected as invalid for a variety of reasons - the address may not exist, the address may have invalid syntax, the address may have exceeded its quota, etc.
Note that
| |
| send | back to summary |
|---|---|
| public static void send(Message msg, Address[] addresses) throws MessagingException Send the message to the specified addresses, ignoring any
recipients specified in the message itself. The
| |
| send | back to summary |
|---|---|
| public static void send(Message msg, String user, String password) throws MessagingException Send a message. The message will be sent to all recipient
addresses specified in the message (as returned from the
Use the specified user name and password to authenticate to the mail server.
| |
| send | back to summary |
|---|---|
| public static void send(Message msg, Address[] addresses, String user, String password) throws MessagingException Send the message to the specified addresses, ignoring any
recipients specified in the message itself. The
Use the specified user name and password to authenticate to the mail server.
| |
| send0 | back to summary |
|---|---|
| private static void send0(Message msg, Address[] addresses, String user, String password) throws MessagingException | |
| sendMessage | back to summary |
|---|---|
| public abstract void sendMessage(Message msg, Address[] addresses) throws MessagingException Send the Message to the specified list of addresses. An appropriate TransportEvent indicating the delivery status is delivered to any TransportListener registered on this Transport. Also, if any of the addresses is invalid, a SendFailedException is thrown. Whether or not the message is still sent succesfully to any valid addresses depends on the Transport implementation.
Unlike the static
| |