public abstract class Transport extends Service
Constructor and Description |
---|
Transport(Session session,
URLName url)
Constructor.
|
Modifier and Type | Method and 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.
|
static void |
send(Message msg,
Address[] addresses,
java.lang.String username,
java.lang.String password)
Sends the message to the specified addresses, ignoring any recipients
specified in the message itself.
|
static void |
send(Message msg,
java.lang.String username,
java.lang.String password)
Sends the specified message.
|
abstract void |
sendMessage(Message msg,
Address[] addresses)
Sends the message to the specified list of addresses.
|
addConnectionListener, close, connect, connect, connect, connect, getURLName, isConnected, notifyConnectionListeners, protocolConnect, queueEvent, removeConnectionListener, setConnected, setURLName, toString
public static void send(Message msg) throws MessagingException
javamail.address.map
resource).msg
- the message to sendSendFailedException
- if the message could not be sent to
some or any of the recipientsMessagingException
public static void send(Message msg, java.lang.String username, java.lang.String password) throws MessagingException
javamail.address.map
resource).msg
- the message to sendusername
- the name of the user to authenticate aspassword
- the password of the user to authenticate asSendFailedException
- if the message could not be sent to
some or any of the recipientsMessagingException
public static void send(Message msg, Address[] addresses) throws MessagingException
msg
- the message to sendaddresses
- the addresses to which to send the messageSendFailedException
- if the message could not be sent to
some or any of the recipientsMessagingException
public static void send(Message msg, Address[] addresses, java.lang.String username, java.lang.String password) throws MessagingException
msg
- the message to sendaddresses
- the addresses to which to send the messageusername
- the name of the user to authenticate aspassword
- the password of the user to authenticate asSendFailedException
- if the message could not be sent to
some or any of the recipientsMessagingException
public abstract void sendMessage(Message msg, Address[] addresses) throws MessagingException
msg
- the message to be sentaddresses
- the addresses to send this message toSendFailedException
- if the send failed because of
invalid addressesMessagingException
- if the transport is not connectedpublic void addTransportListener(TransportListener l)
public void removeTransportListener(TransportListener l)