public class SMTPTransport extends Transport
Modifier and Type | Field and Description |
---|---|
protected SMTPConnection |
connection
The connection used to communicate with the server.
|
protected java.lang.String |
localHostName |
Constructor and Description |
---|
SMTPTransport(Session session,
URLName urlName)
Creates a new
SMTPTransport instance. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this transport.
|
java.lang.String |
getGreeting()
Returns the greeting banner.
|
protected boolean |
protocolConnect(java.lang.String host,
int port,
java.lang.String username,
java.lang.String password)
Connects to the SMTP server.
|
void |
sendMessage(Message message,
Address[] addresses)
Send the specified message to the server.
|
addTransportListener, notifyTransportListeners, removeTransportListener, send, send, send, send
addConnectionListener, connect, connect, connect, connect, getURLName, isConnected, notifyConnectionListeners, queueEvent, removeConnectionListener, setConnected, setURLName, toString
protected SMTPConnection connection
protected java.lang.String localHostName
protected boolean protocolConnect(java.lang.String host, int port, java.lang.String username, java.lang.String password) throws MessagingException
protocolConnect
in class Service
host
- the name of the host to connect toport
- the port to use (-1 for the default port)username
- the usernamepassword
- the passwordAuthenticationFailedException
- on authentication failureMessagingException
- for non-authentication failurespublic java.lang.String getGreeting() throws MessagingException
MessagingException
public void sendMessage(Message message, Address[] addresses) throws MessagingException, SendFailedException
sendMessage
in class Transport
message
- 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 close() throws MessagingException
close
in class Service
MessagingException