public class ImapMailReceiver extends AbstractMailReceiver
MailReceiver
implementation for receiving mail messages from a
mail server that supports the IMAP protocol. In addition to the pollable
AbstractMailReceiver.receive()
method, the waitForNewMessages()
method provides
the option of blocking until new messages are available prior to calling
AbstractMailReceiver.receive()
. That option is only available if the server supports
the idle
command.MailReceiver.MailReceiverContext
folderOpenMode, initialized, logger, SI_USER_FLAG
Constructor and Description |
---|
ImapMailReceiver() |
ImapMailReceiver(java.lang.String url) |
Modifier and Type | Method and Description |
---|---|
java.lang.Boolean |
isShouldMarkMessagesAsRead()
Check if messages should be marked as read.
|
protected javax.mail.Message[] |
searchForNewMessages()
Retrieves new messages from this receiver's folder.
|
protected void |
setAdditionalFlags(javax.mail.Message message)
Optional method allowing you to set additional flags.
|
void |
setSearchTermStrategy(SearchTermStrategy searchTermStrategy)
Provides a way to set custom
SearchTermStrategy to compile a SearchTerm
to be applied when retrieving mail |
void |
setShouldMarkMessagesAsRead(java.lang.Boolean shouldMarkMessagesAsRead)
Specify if messages should be marked as read.
|
void |
waitForNewMessages()
This method is unique to the IMAP receiver and only works if IMAP IDLE
is supported (see RFC 2177 for more detail).
|
deleteMessages, destroy, fetchMessages, getFolder, onInit, openFolder, receive, setJavaMailAuthenticator, setJavaMailProperties, setMaxFetchSize, setProtocol, setSelectorExpression, setSession, setShouldDeleteMessages, shouldDeleteMessages, toString
afterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getComponentType, getConversionService, getIntegrationProperties, getIntegrationProperty, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler
public ImapMailReceiver()
public ImapMailReceiver(java.lang.String url)
public java.lang.Boolean isShouldMarkMessagesAsRead()
public void setSearchTermStrategy(SearchTermStrategy searchTermStrategy)
SearchTermStrategy
to compile a SearchTerm
to be applied when retrieving mailsearchTermStrategy
- public void setShouldMarkMessagesAsRead(java.lang.Boolean shouldMarkMessagesAsRead)
public void waitForNewMessages() throws javax.mail.MessagingException
javax.mail.MessagingException
protected javax.mail.Message[] searchForNewMessages() throws javax.mail.MessagingException
SearchTerm
that searches for all messages in the
folder that are RECENT
, not
ANSWERED
, and not
DELETED
. The search term is used
to search
for new messages.searchForNewMessages
in class AbstractMailReceiver
javax.mail.MessagingException
- in case of JavaMail errorsprotected void setAdditionalFlags(javax.mail.Message message) throws javax.mail.MessagingException
AbstractMailReceiver
setAdditionalFlags
in class AbstractMailReceiver
javax.mail.MessagingException