With spring IMAP adapter, how do I get an email that was marked "unread" manually?

I have a piece of code that uses the IMAP integrator to integrate w760> to poll a mailbox to read all incoming emails that are unread and that work great. But if I open any email message and then mark it as "unread" in my Outlook mailbox, it won't receive the marked email. I can use the pop3 adapter which fetches all emails but removes their afterword, but I want to keep the emails in my inbox and I want the poller to fetch all invisible emails.

Any suggestions on how to solve this problem? I've searched and read articles on email adapters but didn't find anything useful.

Thanks in advance.

+2


source to share


1 answer


Sounds like you need a custom "search strategy". From SI documentation:

By default, ImapMailReceiver will look for Messages based on the default SearchTerm, which are all mails that are LAST (if supported), that are NOT ANSWERED, NOT DELETED, that are NOT SEEED, and have not been processed by this (enabled with a custom USER flag or just NOT FLAGGED if not supported). As of version 2.2, the SearchTerm used by ImapMailReceiver is fully customizable using SearchTermStrategy, which you can enter using the search-term-strategy attribute. SearchTermStrategy is a simple strategic interface with a single method that allows you to create an instance of SearchTerm that ImapMailReceiver will use.

And here is a post from the SI forum describing funtastic Oleg: Server does not support RECENT or USER flags



And here you can find SI DefaultSearchTermStrategy : this is the place to define how you should implement your own strategy. I think you are dealing:

This mail server does not support the RECENT flag, but it does support USER flags that will be used to avoid duplication while sending email.

Switch the SI mail logging level to DEBUG and see which flag your mail server supports.

+2


source







All Articles