- JavaMail uses JDK 1.1 type event-handling mechanism. You can register your class as listeners to subclasses of
MailEvent
class. The Transport, Store and Folder classes generate such events. - A Transport object generates
ConnectionEvent
andTransportEvent
. If the transport object connects successfully, it will fire the ConnectionEvent with the type set toOPENED
. If the connection times out or is closed, ConnectionEvent with typeCLOSED
is generated. The sendMessage method of a Transport object generates a TransportEvent which contains information about the method's success or failure. The event object contains three arrays of address arrays:validSent[], validUnsent[] and invalid[]
:MESSAGE_DELIVERED
: Message sent to all recipients successfully. validSent[] contains all the addresses. validUnsent[] and invalid[] are null.MESSAGE_NOT_DELIVERED
: When ValidSent[] is null, the message was not successfully sent to any recipients. validUnsent[] may have addresses that are valid. invalid[] may contain invalid addresses.MESSAGE_PARTIALLY_DELIVERED
: Message was successfully sent to some recipients but not to all. ValidSent[] holds addresses of recipients to whom the message was sent. validUnsent[] holds valid addresses but the message wasn't sent to them. invalid[] holds invalid addresses.
- A Store object generates
ConnectionEvent
(generated on a successful connection or close),StoreEvent
(event.getMessageType
ALERT
orNOTICE
),FolderEvent
(upon creation, deletion or renaming of a Folder). method returns either - A Folder object generates
ConnectionEvent
(a Folder is opened or closed),FolderEvent
(this folder creates, deletes or renames) andMessageCountEvent
(message count has changed, expunged Message objects are in the event).
Thursday, July 15, 2010
JavaMail Events
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment