Movatterモバイル変換


[0]ホーム

URL:


         


Class Transport

java.lang.Object  |  +--javax.mail.Service        |        +--javax.mail.Transport

public abstract classTransport
extendsService

An abstract class that models a message transport. Subclasses provide actual implementations.

Note thatTransport extends theService class, which provides many common methods for naming transports, connecting to transports, and listening to connection events.

See Also:
Service,ConnectionEvent,TransportEvent

Fields inherited from class javax.mail.Service
debug,session,url
 
Transport(Session session,URLName urlname)
          Constructor.
 
addTransportListener(TransportListener l)
          Add a listener for Transport events.
notifyTransportListeners(int type,Address[] validSent,Address[] validUnsent,Address[] invalid,Message msg)
          Notify all TransportListeners.
removeTransportListener(TransportListener l)
          Remove a listener for Transport events.
send(Message msg)
          Send a message.
send(Message msg,Address[] addresses)
          Send the message to the specified addresses, ignoring any recipients specified in the message itself.
sendMessage(Message msg,Address[] addresses)
          Send the Message to the specified list of addresses.
 
Methods inherited from class javax.mail.Service
addConnectionListener,close,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
 

Transport

publicTransport(Session session,URLName urlname)
Constructor.
Parameters:
session - Session object for this Transport.
urlName - URLName object to be used for this Transport

send

public static voidsend(Message msg)                 throwsMessagingException
Send a message. The message will be sent to all recipient addresses specified in the message (as returned from theMessage methodgetAllRecipients), using message transports appropriate to each address. Thesend method calls thesaveChanges method on the message before sending it.

If any of the recipient addresses is invalid, a SendFailedException is thrown. Clients can get more detail about the failure by examining the exception. Whether or not the message is still sent succesfully to any valid addresses depends on the Transport implementation. See SendFailedException for more details. Note also that success does not imply that the message was delivered to the ultimate recipient, as failures may occur in later stages of delivery. Once a Transport accepts a message for delivery to a recipient, failures that occur later should be reported to the user via another mechanism, such as returning the undeliverable message.

Parameters:
msg - the message to send
Throws:
SendFailedException - if the message could notbe sent to some or any of the recipients.
MessagingException -  
See Also:
Message.saveChanges(),Message.getAllRecipients(),send(Message, Address[]),SendFailedException

send

public static voidsend(Message msg,Address[] addresses)                 throwsMessagingException
Send the message to the specified addresses, ignoring any recipients specified in the message itself. Thesend method calls thesaveChanges method on the message before sending it.

Parameters:
msg - the message to send
addresses - the addresses to which to send the message
Throws:
SendFailedException - if the message could notbe sent to some or any of the recipients.
MessagingException -  
See Also:
Message.saveChanges(),send(Message),SendFailedException

sendMessage

public abstract voidsendMessage(Message msg,Address[] addresses)                          throwsMessagingException
Send the Message to the specified list of addresses. An appropriate TransportEvent indicating the delivery status is delivered to any TransportListener registered on this Transport. Also, if any of the addresses is invalid, a SendFailedException is thrown. Note however, that the messageis sent to the valid addresses.

Unlike the staticsend method, thesendMessage method doesnot call thesaveChanges method on the message; the caller should do so.

Parameters:
Message - The Message to be sent
address - List of addresses to send this message to
Throws:
SendFailedException - if the send failed because ofinvalid addresses.
MessagingException - if the connection is dead or not in the connected state
See Also:
TransportEvent

addTransportListener

public voidaddTransportListener(TransportListener l)
Add a listener for Transport events.

The default implementation provided here adds this listener to an internal list of TransportListeners.

Parameters:
l - the Listener for Transport events
See Also:
TransportEvent

removeTransportListener

public voidremoveTransportListener(TransportListener l)
Remove a listener for Transport events.

The default implementation provided here removes this listener from the internal list of TransportListeners.

Parameters:
l - the listener
See Also:
addTransportListener(javax.mail.event.TransportListener)

notifyTransportListeners

protected voidnotifyTransportListeners(int type,Address[] validSent,Address[] validUnsent,Address[] invalid,Message msg)
Notify all TransportListeners. Transport implementations are expected to use this method to broadcast TransportEvents.

The provided default implementation queues the event into an internal event queue. An event dispatcher thread dequeues events from the queue and dispatches them to the registered TransportListeners. Note that the event dispatching occurs in a separate thread, thus avoiding potential deadlock problems.


         


[8]ページ先頭

©2009-2025 Movatter.jp