Package javax.mail
Class Transport
- java.lang.Object
-
- javax.mail.Service
-
- javax.mail.Transport
-
- Direct Known Subclasses:
NNTPTransport
,SMTPTransport
public abstract class Transport extends Service
A message transport mechanism that can be used to deliver messages.- Version:
- 1.4
- Author:
- Chris Burdess
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addTransportListener(TransportListener l)
Adds a listener for transport events.protected void
notifyTransportListeners(int type, Address[] validSent, Address[] validUnsent, Address[] invalid, Message msg)
Notifies all transport listeners.void
removeTransportListener(TransportListener l)
Removes a transport event listener.static void
send(Message msg)
Sends the specified message.static void
send(Message msg, Address[] addresses)
Sends the message to the specified addresses, ignoring any recipients specified in the message itself.abstract void
sendMessage(Message msg, Address[] addresses)
Sends the message to the specified list of addresses.-
Methods inherited from class javax.mail.Service
addConnectionListener, close, connect, connect, connect, connect, getURLName, isConnected, notifyConnectionListeners, protocolConnect, queueEvent, removeConnectionListener, setConnected, setURLName, toString
-
-
-
-
Method Detail
-
send
public static void send(Message msg) throws MessagingException
Sends the specified message. The message will be sent to all recipient addresses specified in the message, using transports appropriate to each address (specified by thejavamail.address.map
resource).- Parameters:
msg
- the message to send- Throws:
SendFailedException
- if the message could not be sent to some or any of the recipientsMessagingException
-
send
public static void send(Message msg, Address[] addresses) throws MessagingException
Sends the message to the specified addresses, ignoring any recipients specified in the message itself.- Parameters:
msg
- the message to sendaddresses
- the addresses to which to send the message- Throws:
SendFailedException
- if the message could not be sent to some or any of the recipientsMessagingException
-
sendMessage
public abstract void sendMessage(Message msg, Address[] addresses) throws MessagingException
Sends the message to the specified list of addresses.- Parameters:
msg
- the message to be sentaddresses
- the addresses to send this message to- Throws:
SendFailedException
- if the send failed because of invalid addressesMessagingException
- if the transport is not connected
-
addTransportListener
public void addTransportListener(TransportListener l)
Adds a listener for transport events.
-
removeTransportListener
public void removeTransportListener(TransportListener l)
Removes a transport event listener.
-
-