gnu.mail.providers.smtp

Class SMTPTransport


public class SMTPTransport
extends Transport

This transport handles communications with an SMTP server.

Field Summary

protected SMTPConnection
connection
The connection used to communicate with the server.
protected String
localHostName

Fields inherited from class javax.mail.Service

debug, session, url

Constructor Summary

SMTPTransport(Session session, URLName urlName)
Creates a new SMTPTransport instance.

Method Summary

void
close()
Close this transport.
String
getGreeting()
Returns the greeting banner.
protected boolean
protocolConnect(String host, int port, String username, String password)
Connects to the SMTP server.
void
sendMessage(Message message, Address[] addresses)
Send the specified message to the server.

Methods inherited from class javax.mail.Transport

addTransportListener, notifyTransportListeners, removeTransportListener, send, send, sendMessage

Methods inherited from class javax.mail.Service

addConnectionListener, close, connect, connect, connect, getURLName, isConnected, notifyConnectionListeners, protocolConnect, removeConnectionListener, setConnected, setURLName, toString

Field Details

connection

protected SMTPConnection connection
The connection used to communicate with the server.


localHostName

protected String localHostName

Constructor Details

SMTPTransport

public SMTPTransport(Session session,
                     URLName urlName)
Creates a new SMTPTransport instance.

Parameters:
session - a Session value
urlName - an URLName value

Method Details

close

public void close()
            throws MessagingException
Close this transport.
Overrides:
close in interface Service


getGreeting

public String getGreeting()
            throws MessagingException
Returns the greeting banner.


protocolConnect

protected boolean protocolConnect(String host,
                                  int port,
                                  String username,
                                  String password)
            throws MessagingException
Connects to the SMTP server.
Overrides:
protocolConnect in interface Service


sendMessage

public void sendMessage(Message message,
                        Address[] addresses)
            throws MessagingException,
                   SendFailedException
Send the specified message to the server.
Overrides:
sendMessage in interface Transport