kaos.notification.email
Class EmailClient

java.lang.Object
  extended by kaos.notification.email.EmailClient
Direct Known Subclasses:
PagerClient

public class EmailClient
extends java.lang.Object


Field Summary
protected  java.lang.String _host
           
protected  kaos.notification.email.EmailClient.MailChecker _mailChecker
           
protected  java.util.Hashtable _messages
           
protected  int _port
           
protected  java.lang.String _protocol
           
protected  java.lang.String _pw
           
protected  Session _session
           
protected static java.util.Hashtable _statusOrdering
           
protected  java.lang.String _user
           
protected  java.lang.String _userAddr
           
static java.lang.String HDR_DELIVERY_NOTIFY_TO
           
static java.lang.String HDR_DISPOSITION_NOTIFY_TO
           
static java.lang.String HDR_IMPORTANCE
           
static java.lang.String HDR_IN_REPLY_TO
           
static java.lang.String HDR_MAILER
           
static java.lang.String HDR_MS_PRIORITY
           
static java.lang.String HDR_MSG_ID
           
static java.lang.String HDR_ORIG_MSG_ID
           
static java.lang.String HDR_PRIORITY
           
static java.lang.String HDR_RECEIPT_TO
           
static java.lang.String HDRVAL_KAOSEMAIL
           
static java.lang.String HDRVAL_PRIORITY_1
           
static java.lang.String HDRVAL_PRIORITY_HIGH
           
static java.lang.String INBOX
           
static java.lang.String MIME_MULTI_REPORT
           
static java.lang.String MIME_TEXT_HEADERS
           
static java.lang.String PROP_MAIL_HOST
           
static java.lang.String STATUS_ACK
           
static java.lang.String STATUS_DELIVER_FAIL
           
static java.lang.String STATUS_DELIVERED
           
static java.lang.String STATUS_ESCALATED
           
static java.lang.String STATUS_NOT_READ
           
static java.lang.String STATUS_READ
           
static java.lang.String STATUS_SEND_FAIL
           
static java.lang.String STATUS_SENT
           
static java.lang.String SUBJ_DELIVERED
           
static java.lang.String SUBJ_NOT_READ
           
static java.lang.String SUBJ_READ
           
static java.lang.String SUBJ_UNDELIVERABLE
           
 
Constructor Summary
EmailClient()
           
EmailClient(java.lang.String host, int port, java.lang.String protocol, java.lang.String user, java.lang.String pw)
           
 
Method Summary
 Message[] checkMessages(java.lang.String mbox)
           
 void dumpEnvelope(Message m)
           
 void dumpPart(Part p)
           
 boolean handleAsAcknowledge(Message m)
           
 boolean handleAsDeliveryStatusMessage(Message m)
           
 boolean handleAsReadReceipt(Message m)
           
 void initSession()
           
 void logMessage(java.lang.String message, int indentLevel)
          Utility for writing terminal messages.
static void main(java.lang.String[] args)
           
 void pr(java.lang.String s)
          Print a, possibly indented, string.
 void printHeaders(Message msg)
           
 void send(java.lang.String to, java.lang.String subject, java.lang.String body, boolean markImportant)
           
 void send(java.lang.String to, java.lang.String from, java.lang.String subject, java.lang.String body, boolean markImportant)
          "send" method to send the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_SENT

public static final java.lang.String STATUS_SENT
See Also:
Constant Field Values

STATUS_SEND_FAIL

public static final java.lang.String STATUS_SEND_FAIL
See Also:
Constant Field Values

STATUS_DELIVERED

public static final java.lang.String STATUS_DELIVERED
See Also:
Constant Field Values

STATUS_DELIVER_FAIL

public static final java.lang.String STATUS_DELIVER_FAIL
See Also:
Constant Field Values

STATUS_READ

public static final java.lang.String STATUS_READ
See Also:
Constant Field Values

STATUS_NOT_READ

public static final java.lang.String STATUS_NOT_READ
See Also:
Constant Field Values

STATUS_ACK

public static final java.lang.String STATUS_ACK
See Also:
Constant Field Values

STATUS_ESCALATED

public static final java.lang.String STATUS_ESCALATED
See Also:
Constant Field Values

PROP_MAIL_HOST

public static final java.lang.String PROP_MAIL_HOST
See Also:
Constant Field Values

INBOX

public static final java.lang.String INBOX
See Also:
Constant Field Values

HDR_MSG_ID

public static final java.lang.String HDR_MSG_ID
See Also:
Constant Field Values

HDR_ORIG_MSG_ID

public static final java.lang.String HDR_ORIG_MSG_ID
See Also:
Constant Field Values

HDR_IN_REPLY_TO

public static final java.lang.String HDR_IN_REPLY_TO
See Also:
Constant Field Values

HDR_RECEIPT_TO

public static final java.lang.String HDR_RECEIPT_TO
See Also:
Constant Field Values

HDR_DELIVERY_NOTIFY_TO

public static final java.lang.String HDR_DELIVERY_NOTIFY_TO
See Also:
Constant Field Values

HDR_DISPOSITION_NOTIFY_TO

public static final java.lang.String HDR_DISPOSITION_NOTIFY_TO
See Also:
Constant Field Values

HDR_MAILER

public static final java.lang.String HDR_MAILER
See Also:
Constant Field Values

HDRVAL_KAOSEMAIL

public static final java.lang.String HDRVAL_KAOSEMAIL
See Also:
Constant Field Values

HDR_PRIORITY

public static final java.lang.String HDR_PRIORITY
See Also:
Constant Field Values

HDRVAL_PRIORITY_1

public static final java.lang.String HDRVAL_PRIORITY_1
See Also:
Constant Field Values

HDR_MS_PRIORITY

public static final java.lang.String HDR_MS_PRIORITY
See Also:
Constant Field Values

HDR_IMPORTANCE

public static final java.lang.String HDR_IMPORTANCE
See Also:
Constant Field Values

HDRVAL_PRIORITY_HIGH

public static final java.lang.String HDRVAL_PRIORITY_HIGH
See Also:
Constant Field Values

SUBJ_READ

public static final java.lang.String SUBJ_READ
See Also:
Constant Field Values

SUBJ_NOT_READ

public static final java.lang.String SUBJ_NOT_READ
See Also:
Constant Field Values

SUBJ_DELIVERED

public static final java.lang.String SUBJ_DELIVERED
See Also:
Constant Field Values

SUBJ_UNDELIVERABLE

public static final java.lang.String SUBJ_UNDELIVERABLE
See Also:
Constant Field Values

MIME_MULTI_REPORT

public static final java.lang.String MIME_MULTI_REPORT
See Also:
Constant Field Values

MIME_TEXT_HEADERS

public static final java.lang.String MIME_TEXT_HEADERS
See Also:
Constant Field Values

_messages

protected java.util.Hashtable _messages

_host

protected java.lang.String _host

_user

protected java.lang.String _user

_userAddr

protected java.lang.String _userAddr

_pw

protected java.lang.String _pw

_port

protected int _port

_protocol

protected java.lang.String _protocol

_session

protected Session _session

_mailChecker

protected kaos.notification.email.EmailClient.MailChecker _mailChecker

_statusOrdering

protected static java.util.Hashtable _statusOrdering
Constructor Detail

EmailClient

public EmailClient()

EmailClient

public EmailClient(java.lang.String host,
                   int port,
                   java.lang.String protocol,
                   java.lang.String user,
                   java.lang.String pw)
Method Detail

main

public static void main(java.lang.String[] args)

initSession

public void initSession()

send

public void send(java.lang.String to,
                 java.lang.String subject,
                 java.lang.String body,
                 boolean markImportant)
          throws MessagingException
Throws:
MessagingException

send

public void send(java.lang.String to,
                 java.lang.String from,
                 java.lang.String subject,
                 java.lang.String body,
                 boolean markImportant)
          throws MessagingException
"send" method to send the message.

Throws:
MessagingException

checkMessages

public Message[] checkMessages(java.lang.String mbox)

handleAsDeliveryStatusMessage

public boolean handleAsDeliveryStatusMessage(Message m)
                                      throws java.io.IOException,
                                             MessagingException
Throws:
java.io.IOException
MessagingException

handleAsReadReceipt

public boolean handleAsReadReceipt(Message m)
                            throws MessagingException
Throws:
MessagingException

handleAsAcknowledge

public boolean handleAsAcknowledge(Message m)
                            throws java.io.IOException,
                                   MessagingException
Throws:
java.io.IOException
MessagingException

dumpPart

public void dumpPart(Part p)
              throws java.lang.Exception
Throws:
java.lang.Exception

dumpEnvelope

public void dumpEnvelope(Message m)
                  throws java.lang.Exception
Throws:
java.lang.Exception

printHeaders

public void printHeaders(Message msg)
                  throws MessagingException
Throws:
MessagingException

pr

public void pr(java.lang.String s)
Print a, possibly indented, string.


logMessage

public void logMessage(java.lang.String message,
                       int indentLevel)
Utility for writing terminal messages. Identifies the agent writing the message. Synchronized to prevent interleaving of messages.

Parameters:
message -
indentLevel -