org.opennms.javamail
Class JavaReadMailer

java.lang.Object
  extended by org.opennms.javamail.JavaMailer2
      extended by org.opennms.javamail.JavaReadMailer

public class JavaReadMailer
extends JavaMailer2

JavaMail implementation for reading electronic mail.

Author:
David Hustace

Nested Class Summary
 
Nested classes/interfaces inherited from class org.opennms.javamail.JavaMailer2
JavaMailer2.LoggingByteArrayOutputStream, JavaMailer2.LoggingTransportListener
 
Constructor Summary
JavaReadMailer(ReadmailConfig config, Boolean closeOnDelete)
           
 
Method Summary
protected  void finalize()
          Finalizer to be sure and close with the appropriate mode any open folders
 List<Message> getMessages()
           
static List<String> getText(Message msg)
          Attempts to reteive the string portion of a message...
 Boolean isDeleteOnClose()
           
 List<Message> retrieveMessages()
           
 List<Message> retrieveMessages(SearchTerm term)
           
 void setDeleteOnClose(Boolean deleteOnClose)
           
static List<String> string2Lines(String text)
           
 
Methods inherited from class org.opennms.javamail.JavaMailer2
createAuthenticator, createFileAttachment, getMailProps, getSession, log, setDebug, setSession
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaReadMailer

public JavaReadMailer(ReadmailConfig config,
                      Boolean closeOnDelete)
               throws JavaMailerException
Throws:
JavaMailerException
Method Detail

finalize

protected void finalize()
                 throws Throwable
Finalizer to be sure and close with the appropriate mode any open folders

Overrides:
finalize in class Object
Throws:
Throwable

retrieveMessages

public List<Message> retrieveMessages()
                               throws JavaMailerException
Throws:
JavaMailerException

retrieveMessages

public List<Message> retrieveMessages(SearchTerm term)
                               throws JavaMailerException
Parameters:
term -
Throws:
JavaMailerException

getMessages

public List<Message> getMessages()

getText

public static List<String> getText(Message msg)
                            throws MessagingException,
                                   IOException
Attempts to reteive the string portion of a message... tries to handle multipart messages as well. This seems to be working so far with my tests but could use some tweaking later as more types of mail servers are used with this feature.

Parameters:
msg -
Returns:
The text portion of an email with each line being an element of the list.
Throws:
MessagingException
IOException

isDeleteOnClose

public Boolean isDeleteOnClose()

setDeleteOnClose

public void setDeleteOnClose(Boolean deleteOnClose)

string2Lines

public static List<String> string2Lines(String text)


Copyright © 2009. All Rights Reserved.