Package org.opennms.javamail
Class JavaReadMailer
- java.lang.Object
-
- org.opennms.javamail.JavaMailer2
-
- org.opennms.javamail.JavaReadMailer
-
public class JavaReadMailer extends JavaMailer2
JavaMail implementation for reading electronic mail.- Version:
- $Id: $
- Author:
- David Hustace
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opennms.javamail.JavaMailer2
JavaMailer2.LoggingByteArrayOutputStream, JavaMailer2.LoggingTransportListener
-
-
Constructor Summary
Constructors Constructor Description JavaReadMailer(ReadmailConfig config, Boolean closeOnDelete)
Constructor for JavaReadMailer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
finalize()
Finalizer to be sure and close with the appropriate mode any open foldersList<javax.mail.Message>
getMessages()
getMessagesstatic List<String>
getText(javax.mail.Message msg)
Attempts to reteive the string portion of a message...Boolean
isDeleteOnClose()
isDeleteOnCloseList<javax.mail.Message>
retrieveMessages()
retrieveMessagesList<javax.mail.Message>
retrieveMessages(javax.mail.search.SearchTerm term)
retrieveMessagesvoid
setDeleteOnClose(Boolean deleteOnClose)
setDeleteOnClosestatic List<String>
string2Lines(String text)
string2Lines-
Methods inherited from class org.opennms.javamail.JavaMailer2
createAuthenticator, createFileAttachment, getMailProps, getSession, setDebug, setSession
-
-
-
-
Constructor Detail
-
JavaReadMailer
public JavaReadMailer(ReadmailConfig config, Boolean closeOnDelete) throws JavaMailerException
Constructor for JavaReadMailer.
- Parameters:
config
- aReadmailConfig
object.closeOnDelete
- aBoolean
object.- Throws:
JavaMailerException
- if any.
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
Finalizer to be sure and close with the appropriate mode any open folders
-
retrieveMessages
public List<javax.mail.Message> retrieveMessages() throws JavaMailerException
retrieveMessages
- Returns:
- a
List
object. - Throws:
JavaMailerException
- if any.
-
retrieveMessages
public List<javax.mail.Message> retrieveMessages(javax.mail.search.SearchTerm term) throws JavaMailerException
retrieveMessages
- Parameters:
term
- aSearchTerm
object.- Returns:
- a
List
object. - Throws:
JavaMailerException
- if any.
-
getText
public static List<String> getText(javax.mail.Message msg) throws javax.mail.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
- aMessage
object.- Returns:
- The text portion of an email with each line being an element of the list.
- Throws:
javax.mail.MessagingException
- if any.IOException
- if any.
-
setDeleteOnClose
public void setDeleteOnClose(Boolean deleteOnClose)
setDeleteOnClose
- Parameters:
deleteOnClose
- aBoolean
object.
-
-