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.MailReceiverContextfolderOpenMode, initialized, logger, SI_USER_FLAG| Constructor and Description |
|---|
ImapMailReceiver() |
ImapMailReceiver(String url) |
| Modifier and Type | Method and Description |
|---|---|
Boolean |
isShouldMarkMessagesAsRead()
Check if messages should be marked as read.
|
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
protected Message[] |
searchForNewMessages()
Retrieves new messages from this receiver's folder.
|
protected void |
setAdditionalFlags(Message message)
Optional method allowing you to set additional flags.
|
void |
setCancelIdleInterval(long cancelIdleInterval)
IDLE commands will be terminated after this interval; useful in cases where a connection
might be silently dropped.
|
void |
setSearchTermStrategy(SearchTermStrategy searchTermStrategy)
Provides a way to set custom
SearchTermStrategy to compile a SearchTerm
to be applied when retrieving mail |
void |
setShouldMarkMessagesAsRead(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, getJavaMailProperties, openFolder, receive, setJavaMailAuthenticator, setJavaMailProperties, setMaxFetchSize, setProtocol, setSelectorExpression, setSession, setShouldDeleteMessages, shouldDeleteMessages, toStringafterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getComponentName, getComponentType, getConversionService, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, setMessageBuilderFactory, setTaskSchedulerpublic ImapMailReceiver()
public ImapMailReceiver(String url)
public Boolean isShouldMarkMessagesAsRead()
public void setSearchTermStrategy(SearchTermStrategy searchTermStrategy)
SearchTermStrategy to compile a SearchTerm
to be applied when retrieving mailsearchTermStrategy - The search term strategy implementation.public void setShouldMarkMessagesAsRead(Boolean shouldMarkMessagesAsRead)
shouldMarkMessagesAsRead - true if messages should be marked as read.public void setCancelIdleInterval(long cancelIdleInterval)
cancelIdleInterval - the cancelIdleInterval to setprotected void onInit()
throws Exception
IntegrationObjectSupportonInit in class AbstractMailReceiverException - Any exception.public void waitForNewMessages()
throws MessagingException
MessagingException - Any MessagingException.protected Message[] searchForNewMessages() throws 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 AbstractMailReceiverMessagingException - in case of JavaMail errorsprotected void setAdditionalFlags(Message message) throws MessagingException
AbstractMailReceiversetAdditionalFlags in class AbstractMailReceivermessage - The message.MessagingException - A MessagingException.