org.springframework.integration.mail
Class ImapMailReceiver
java.lang.Object
org.springframework.integration.mail.AbstractMailReceiver
org.springframework.integration.mail.ImapMailReceiver
- All Implemented Interfaces:
- org.springframework.beans.factory.DisposableBean, MailReceiver
public class ImapMailReceiver
- extends AbstractMailReceiver
A 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.
- Author:
- Arjen Poutsma, Mark Fisher
Method Summary |
protected javax.mail.Message[] |
searchForNewMessages()
Retrieves new messages from this receiver's folder. |
void |
setShouldDeleteMessages(boolean shouldDeleteMessages)
Specify whether mail messages should be deleted after retrieval. |
protected boolean |
shouldDeleteMessages()
Subclasses must implement this method to indicate whether the mail
messages should be deleted after being received. |
void |
waitForNewMessages()
This method is unique to the IMAP receiver and only works if IMAP IDLE
is supported (see RFC 2177 for more detail). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ImapMailReceiver
public ImapMailReceiver(java.lang.String url)
setShouldDeleteMessages
public void setShouldDeleteMessages(boolean shouldDeleteMessages)
- Specify whether mail messages should be deleted after retrieval.
The default is
true
.
shouldDeleteMessages
protected boolean shouldDeleteMessages()
- Description copied from class:
AbstractMailReceiver
- Subclasses must implement this method to indicate whether the mail
messages should be deleted after being received.
- Specified by:
shouldDeleteMessages
in class AbstractMailReceiver
waitForNewMessages
public void waitForNewMessages()
throws javax.mail.MessagingException,
java.lang.InterruptedException
- This method is unique to the IMAP receiver and only works if IMAP IDLE
is supported (see RFC 2177 for more detail).
- Throws:
javax.mail.MessagingException
java.lang.InterruptedException
searchForNewMessages
protected javax.mail.Message[] searchForNewMessages()
throws javax.mail.MessagingException
- Retrieves new messages from this receiver's folder. This implementation
creates a
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.
- Specified by:
searchForNewMessages
in class AbstractMailReceiver
- Returns:
- the new messages
- Throws:
javax.mail.MessagingException
- in case of JavaMail errors