org.tigris.eyebrowse
Class MailUtil

java.lang.Object
  |
  +--org.tigris.eyebrowse.MailUtil

public class MailUtil
extends java.lang.Object

MailUtil Utility class for processing JavaMail messages.

Author:
Brian Goetz - Quiotix Corp, Daniel Rall

Inner Class Summary
protected static class MailUtil.DummyAuthenticator
          A null authenticator.
 
Field Summary
static java.lang.String NO_SUBJECT
          The string to return if the subject is not available
static java.lang.String SENDER_NOT_AVAILABLE
          The string to return if the sender is not available
 
Constructor Summary
MailUtil()
           
 
Method Summary
static java.lang.String canonicalizeSubject(java.lang.String subject)
          Canonicalizes the subject of a mail message, by removing all the various forms of Re: or Fwd: that may be prepended or wrapped around the subject.
static org.tigris.eyebrowse.MimePart[] flattenMessage(org.tigris.eyebrowse.MimeMessage message, ContentTypePreference ctPref)
          Produces a flattened array of MimePart objects obtained by walking the tree of body parts in an inorder traversal.
static java.lang.String getDefaultSender()
          Return the default sender, if the sender found was not usable.
static java.lang.String getDefaultSubject()
          Return the default subject, if the subject found was not usable.
static org.tigris.eyebrowse.Session getJavaMailSession()
          A static method which returns a JavaMail session object which can be used for JavaMail calls which require a session.
static java.lang.String getMessageID(org.tigris.eyebrowse.MimeMessage msg)
          Extracts the MIME Message-ID string from a message, if available.
static java.util.List getReferences(org.tigris.eyebrowse.MimeMessage msg)
          Extracts a list of Message-ID strings corresponding to messages references by the In-Reply-To or References headers of a message.
static java.lang.String getSender(org.tigris.eyebrowse.MimeMessage msg)
          Extracts the sender name from a JavaMail message.
static java.lang.String getSenderEmail(org.tigris.eyebrowse.MimeMessage msg)
          Extracts the sender's email address from a JavaMail message.
static java.lang.String getSubject(org.tigris.eyebrowse.MimeMessage msg)
          Extracts the subject from a JavaMail message.
static boolean isReply(java.lang.String subject)
          Used in conjunction with canonicalizeSubject.
static void releaseJavaMailSession(org.tigris.eyebrowse.Session s)
          A static method which releases a JavaMail session object acquired through getJavaMailSession.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SENDER_NOT_AVAILABLE

public static java.lang.String SENDER_NOT_AVAILABLE
The string to return if the sender is not available
See Also:
getSender, getSenderEmail

NO_SUBJECT

public static java.lang.String NO_SUBJECT
The string to return if the subject is not available
See Also:
getSubject
Constructor Detail

MailUtil

public MailUtil()
Method Detail

getJavaMailSession

public static org.tigris.eyebrowse.Session getJavaMailSession()
A static method which returns a JavaMail session object which can be used for JavaMail calls which require a session. The session is not associated with any actual user or message store.

releaseJavaMailSession

public static void releaseJavaMailSession(org.tigris.eyebrowse.Session s)
A static method which releases a JavaMail session object acquired through getJavaMailSession.

getSender

public static java.lang.String getSender(org.tigris.eyebrowse.MimeMessage msg)
Extracts the sender name from a JavaMail message. If the sender name is not available, the sender's email address is returned instead.
Parameters:
msg -  
Returns:
The name (or email) of the message's sender (String)

getDefaultSender

public static java.lang.String getDefaultSender()
Return the default sender, if the sender found was not usable.

getDefaultSubject

public static java.lang.String getDefaultSubject()
Return the default subject, if the subject found was not usable.

getSenderEmail

public static java.lang.String getSenderEmail(org.tigris.eyebrowse.MimeMessage msg)
Extracts the sender's email address from a JavaMail message.
Parameters:
msg -  
Returns:
Sender's email address (String)

getSubject

public static java.lang.String getSubject(org.tigris.eyebrowse.MimeMessage msg)
Extracts the subject from a JavaMail message.
Parameters:
msg -  
Returns:
The message's subject (String)

canonicalizeSubject

public static java.lang.String canonicalizeSubject(java.lang.String subject)
Canonicalizes the subject of a mail message, by removing all the various forms of Re: or Fwd: that may be prepended or wrapped around the subject.
Parameters:
subject -  

isReply

public static boolean isReply(java.lang.String subject)
Used in conjunction with canonicalizeSubject. If isReply(subject) is true, then the subject matches one of the forms of reply or forwarding that canonicalizeSubject recognizes.
Parameters:
subject - The subject of the possible reply.

getMessageID

public static java.lang.String getMessageID(org.tigris.eyebrowse.MimeMessage msg)
Extracts the MIME Message-ID string from a message, if available.
Parameters:
msg -  
Returns:
Message-ID string, or null if not available.

getReferences

public static java.util.List getReferences(org.tigris.eyebrowse.MimeMessage msg)
Extracts a list of Message-ID strings corresponding to messages references by the In-Reply-To or References headers of a message. May contain duplicates.
Parameters:
msg -  
Returns:
The list of gathered references.

flattenMessage

public static org.tigris.eyebrowse.MimePart[] flattenMessage(org.tigris.eyebrowse.MimeMessage message,
                                                             ContentTypePreference ctPref)
Produces a flattened array of MimePart objects obtained by walking the tree of body parts in an inorder traversal. The ContentTypePreference object is used to determine which parts to include (parts with a zero preference are omitted) and, in the case of multipart/alternative, to select which alternative part to use (the part with the highest preference value is included.)
Parameters:
message -  
ctPref - A ContentTypePreference object used to determine which message body parts to include.


Copyright © 2000 Quiotix Corp. All Rights Reserved.