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, java.lang.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 foldersjava.util.List<javax.mail.Message>
getMessages()
getMessagesstatic java.util.List<java.lang.String>
getText(javax.mail.Message msg)
Attempts to reteive the string portion of a message...java.lang.Boolean
isDeleteOnClose()
isDeleteOnClosejava.util.List<javax.mail.Message>
retrieveMessages()
retrieveMessagesjava.util.List<javax.mail.Message>
retrieveMessages(javax.mail.search.SearchTerm term)
retrieveMessagesvoid
setDeleteOnClose(java.lang.Boolean deleteOnClose)
setDeleteOnClosestatic java.util.List<java.lang.String>
string2Lines(java.lang.String text)
string2Lines-
Methods inherited from class org.opennms.javamail.JavaMailer2
createAuthenticator, createFileAttachment, getMailProps, getSession, setDebug, setSession
-
-
-
-
Constructor Detail
-
JavaReadMailer
public JavaReadMailer(ReadmailConfig config, java.lang.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 java.lang.Throwable
Finalizer to be sure and close with the appropriate mode any open folders- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
retrieveMessages
public java.util.List<javax.mail.Message> retrieveMessages() throws JavaMailerException
retrieveMessages
- Returns:
- a
List
object. - Throws:
JavaMailerException
- if any.
-
retrieveMessages
public java.util.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.
-
getMessages
public java.util.List<javax.mail.Message> getMessages()
getMessages
- Returns:
- a
List
object.
-
getText
public static java.util.List<java.lang.String> getText(javax.mail.Message msg) throws javax.mail.MessagingException, java.io.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.java.io.IOException
- if any.
-
isDeleteOnClose
public java.lang.Boolean isDeleteOnClose()
isDeleteOnClose
- Returns:
- a
Boolean
object.
-
setDeleteOnClose
public void setDeleteOnClose(java.lang.Boolean deleteOnClose)
setDeleteOnClose
- Parameters:
deleteOnClose
- aBoolean
object.
-
string2Lines
public static java.util.List<java.lang.String> string2Lines(java.lang.String text)
string2Lines
- Parameters:
text
- aString
object.- Returns:
- a
List
object.
-
-