gnu.mail.providers.smtp
Class SMTPTransport

java.lang.Object
  extended byjavax.mail.Service
      extended byjavax.mail.Transport
          extended bygnu.mail.providers.smtp.SMTPTransport

public class SMTPTransport
extends Transport

This transport handles communications with an SMTP server.

Version:
2.0
Author:
Andrew Selkirk, Ben Speakmon, Chris Burdess

Field Summary
protected  org.jpackage.mail.inet.smtp.SMTPConnection connection
          The connection used to communicate with the server.
protected  java.lang.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.
 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.
 
Methods inherited from class javax.mail.Transport
addTransportListener, notifyTransportListeners, removeTransportListener, send, send
 
Methods inherited from class javax.mail.Service
addConnectionListener, connect, connect, connect, getURLName, isConnected, notifyConnectionListeners, queueEvent, removeConnectionListener, setConnected, setURLName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

connection

protected org.jpackage.mail.inet.smtp.SMTPConnection connection
The connection used to communicate with the server.


localHostName

protected java.lang.String localHostName
Constructor Detail

SMTPTransport

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

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

protocolConnect

protected boolean protocolConnect(java.lang.String host,
                                  int port,
                                  java.lang.String username,
                                  java.lang.String password)
                           throws MessagingException
Connects to the SMTP server.

Overrides:
protocolConnect in class Service
Parameters:
host - the name of the host to connect to
port - the port to use (-1 for the default port)
username - the username
password - the password
Returns:
true on success, false if authentication failed
Throws:
MessagingException - for non-authentication failures

getGreeting

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

Throws:
MessagingException

sendMessage

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

Specified by:
sendMessage in class Transport
Parameters:
message - the message to be sent
addresses - the addresses to send this message to
Throws:
MessagingException - if the transport is not connected
SendFailedException - if the send failed because of invalid addresses

close

public void close()
           throws MessagingException
Close this transport.

Overrides:
close in class Service
Throws:
MessagingException


© Copyright 2003, 2004 The Free Software Foundation, All rights reserved