javax.mail
Class Transport

java.lang.Object
  extended by javax.mail.Service
      extended by javax.mail.Transport

public abstract class Transport
extends Service

Abstract class modeling a message transport.

Version:
$Rev: 421852 $ $Date: 2006-07-14 03:02:19 -0700 (Fri, 14 Jul 2006) $

Field Summary
 
Fields inherited from class javax.mail.Service
debug, session, url
 
Constructor Summary
Transport(Session session, URLName name)
          Constructor taking Session and URLName parameters required for Service.Service(Session, URLName).
 
Method Summary
 void addTransportListener(TransportListener listener)
           
protected  void notifyTransportListeners(int type, Address[] validSent, Address[] validUnsent, Address[] invalid, Message message)
           
 void removeTransportListener(TransportListener listener)
           
static void send(Message message)
          Send a message to all recipient addresses it contains (as returned by Message.getAllRecipients()) using message transports appropriate for each address.
static void send(Message message, Address[] addresses)
          Send a message to all addresses provided irrespective of any recipients contained in the message itself using message transports appropriate for each address.
abstract  void sendMessage(Message message, Address[] addresses)
          Send a message to the supplied addresses using this transport; if any of the addresses are invalid then a SendFailedException is thrown.
 
Methods inherited from class javax.mail.Service
addConnectionListener, close, connect, connect, connect, connect, finalize, getURLName, isConnected, notifyConnectionListeners, protocolConnect, queueEvent, removeConnectionListener, setConnected, setURLName, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Transport

public Transport(Session session,
                 URLName name)
Constructor taking Session and URLName parameters required for Service.Service(Session, URLName).

Parameters:
session - the Session this transport is for
name - the location this transport is for
Method Detail

send

public static void send(Message message)
                 throws MessagingException
Send a message to all recipient addresses it contains (as returned by Message.getAllRecipients()) using message transports appropriate for each address. Message addresses are checked during submission, but there is no guarantee that the ultimate address is valid or that the message will ever be delivered.

Message.saveChanges() will be called before the message is actually sent.

Parameters:
message - the message to send
Throws:
MessagingException - if there was a problem sending the message

send

public static void send(Message message,
                        Address[] addresses)
                 throws MessagingException
Send a message to all addresses provided irrespective of any recipients contained in the message itself using message transports appropriate for each address. Message addresses are checked during submission, but there is no guarantee that the ultimate address is valid or that the message will ever be delivered.

Message.saveChanges() will be called before the message is actually sent.

Parameters:
message - the message to send
addresses - the addesses to send to
Throws:
MessagingException - if there was a problem sending the message

sendMessage

public abstract void sendMessage(Message message,
                                 Address[] addresses)
                          throws MessagingException
Send a message to the supplied addresses using this transport; if any of the addresses are invalid then a SendFailedException is thrown. Whether the message is actually sent to any of the addresses is undefined.

Unlike the static send(Message, Address[]) method, Message.saveChanges() is not called. A TransportEvent will be sent to registered listeners once the delivery attempt has been made.

Parameters:
message - the message to send
addresses - list of addresses to send it to
Throws:
SendFailedException - if the send failed
MessagingException - if there was a problem sending the message

addTransportListener

public void addTransportListener(TransportListener listener)

removeTransportListener

public void removeTransportListener(TransportListener listener)

notifyTransportListeners

protected void notifyTransportListeners(int type,
                                        Address[] validSent,
                                        Address[] validUnsent,
                                        Address[] invalid,
                                        Message message)


Copyright © 2006 Apache Software Foundation. All Rights Reserved.