xmlBlaster 2.1.0 API

org.xmlBlaster.util.protocol.email
Class MailUtil

java.lang.Object
  extended by org.xmlBlaster.util.protocol.email.MailUtil

public class MailUtil
extends java.lang.Object

Utilities to dump mail messages. We provide a main() to play with POP3 access. Show information about and contents of messages.

Author:
John Mani, Bill Shannon, Marcel Ruff

Field Summary
(package private) static int attnum
           
static java.lang.String BODY_NAME
          Fixed name which is used for the normal email content / body
(package private) static boolean debug
           
(package private) static java.lang.String indentStr
           
private static java.util.logging.Logger log
           
(package private) static boolean saveAttachments
           
(package private) static boolean showAlert
           
(package private) static boolean showStructure
           
(package private) static java.lang.String url
           
(package private) static boolean verbose
           
 
Constructor Summary
MailUtil()
           
 
Method Summary
static java.util.ArrayList accessAttachments(javax.mail.Part p)
          Access all attachments.
static int accessPart(javax.mail.Part p, int level, java.util.ArrayList attachments)
           
static java.lang.String dateTime(java.util.Date date)
           
static java.util.Date dateTime(java.lang.String dateString)
          Transforms an email "date-time" string to a java.util.Date.
static java.lang.String dateTime(java.sql.Timestamp ts)
           
static java.sql.Timestamp dateTimeTS(java.lang.String dateString)
           
static void dumpEnvelope(javax.mail.Message m, int level)
           
static void dumpMessage(javax.mail.Message msg)
           
static void dumpMessages(javax.mail.Message[] msgs)
           
static int dumpPart(javax.mail.Part p, int level)
           
static void main(java.lang.String[] argv)
          Reading POP3 messages and dump them (for testing only).
static void pr(java.lang.String s, int level)
          Print a, possibly indented, string.
private static void testPOP3Read()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static java.util.logging.Logger log

url

static java.lang.String url

verbose

static boolean verbose

debug

static boolean debug

showStructure

static boolean showStructure

showAlert

static boolean showAlert

saveAttachments

static boolean saveAttachments

attnum

static int attnum

BODY_NAME

public static final java.lang.String BODY_NAME
Fixed name which is used for the normal email content / body

See Also:
Constant Field Values

indentStr

static java.lang.String indentStr
Constructor Detail

MailUtil

public MailUtil()
Method Detail

main

public static void main(java.lang.String[] argv)
Reading POP3 messages and dump them (for testing only). Usage:
java org.xmlBlaster.util.protocol.email.MailUtil -L pop3://marcel:marcel@localhost/INBOX
 

Parameters:
argv -

dateTime

public static java.util.Date dateTime(java.lang.String dateString)
Transforms an email "date-time" string to a java.util.Date.
     date-time   =  [ day "," ] date time        ; dd mm yy
                                                 ;  hh:mm:ss zzz

     day         =  "Mon"  / "Tue" /  "Wed"  / "Thu"
                 /  "Fri"  / "Sat" /  "Sun"

     date        =  1*2DIGIT month 2DIGIT        ; day month year
                                                 ;  e.g. 20 Jun 82

     month       =  "Jan"  /  "Feb" /  "Mar"  /  "Apr"
                 /  "May"  /  "Jun" /  "Jul"  /  "Aug"
                 /  "Sep"  /  "Oct" /  "Nov"  /  "Dec"

     time        =  hour zone                    ; ANSI and Military

     hour        =  2DIGIT ":" 2DIGIT [":" 2DIGIT]
                                                 ; 00:00:00 - 23:59:59

     zone        =  "UT"  / "GMT"                ; Universal Time
                                                 ; North American : UT
                 /  "EST" / "EDT"                ;  Eastern:  - 5/ - 4
                 /  "CST" / "CDT"                ;  Central:  - 6/ - 5
                 /  "MST" / "MDT"                ;  Mountain: - 7/ - 6
                 /  "PST" / "PDT"                ;  Pacific:  - 8/ - 7
                 /  1ALPHA                       ; Military: Z = UT;
                                                 ;  A:-1; (J not used)
                                                 ;  M:-12; N:+1; Y:+12
                 / ( ("+" / "-") 4DIGIT )        ; Local differential
                                                 ;  hours+min. (HHMM)
 

Parameters:
dateString - The http://www.faqs.org/rfcs/rfc822.html "date-time" string
Returns:
the date parsed
Throws:
java.lang.IllegalArgumentException - on ParseException
See Also:
http://www.faqs.org/rfcs/rfc2156.html

dateTimeTS

public static java.sql.Timestamp dateTimeTS(java.lang.String dateString)
Parameters:
dateString - The http://www.faqs.org/rfcs/rfc822.html "date-time" string
Returns:
the timestamp parsed
Throws:
java.lang.IllegalArgumentException - on ParseException

dateTime

public static java.lang.String dateTime(java.util.Date date)
Parameters:
date -
Returns:
The http://www.faqs.org/rfcs/rfc822.html "date-time" string

dateTime

public static java.lang.String dateTime(java.sql.Timestamp ts)
Parameters:
ts -
Returns:
The http://www.faqs.org/rfcs/rfc822.html "date-time" string
See Also:
IsoDateParser

testPOP3Read

private static void testPOP3Read()

dumpMessage

public static void dumpMessage(javax.mail.Message msg)
                        throws java.lang.Exception
Throws:
java.lang.Exception

dumpMessages

public static void dumpMessages(javax.mail.Message[] msgs)
                         throws java.lang.Exception
Throws:
java.lang.Exception

accessAttachments

public static java.util.ArrayList accessAttachments(javax.mail.Part p)
                                             throws XmlBlasterException
Access all attachments.

Parameters:
p -
Returns:
a list of AttachmentHolder instances
Throws:
java.lang.Exception
XmlBlasterException

accessPart

public static int accessPart(javax.mail.Part p,
                             int level,
                             java.util.ArrayList attachments)
                      throws XmlBlasterException
Throws:
XmlBlasterException

dumpPart

public static int dumpPart(javax.mail.Part p,
                           int level)
                    throws java.lang.Exception
Throws:
java.lang.Exception

dumpEnvelope

public static void dumpEnvelope(javax.mail.Message m,
                                int level)
                         throws java.lang.Exception
Throws:
java.lang.Exception

pr

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


xmlBlaster 2.1.0 API

Copyright © 1999-2011 The xmlBlaster.org contributers.