Closed spring-operator closed 10 years ago
Neale Upstone commented
This probably applies to me too, as I've got the potential for spam, although in that requirement, a filter later on will be sufficient as I don't care about marking read.
Iain, what level of sophistication are you looking for? e.g. might you want to reference a service to lookup valid keywords in the subject?
Your request sounds like a multi-user mailbox where different users will read messages, and leave others unread.
One approach for the mark-read requirement would be to allow a SpEL expression to execute against the message to determine if the message should be marked read or not. Do you also want this expression to act as a filter as to whether the message left as unread are placed on the channel? (it sounds like you do)
In my case of using IMAP, I can see more complex scenarios of wanting to file messages into folders based on whether they were processed successfully or not. This gets us into IMAP being a potential outbound endpoint ;)
Iain Porter commented
My requirement is based on using the mailbox like a JMS queue. I only want to take messages off the "Inbox/unread" queue that meet my criteria. It would be like subscribing to messages from a certain sender or subject. The main point is that I want to leave messages that I don't subscribe to unread.
Oleg Zhurakousky commented
Implemented as per example below:
<int-mail:imap-idle-channel-adapter id="customAdapter"
store-uri="imaps://springintegration.eip:${password}@imap.gmail.com/INBOX"
. . . .
java-mail-properties="javaMailProperties"
mail-filter-expression="subject matches '(?i).*foo.*'"/>
In the above the email messages will be sent through a fine grained filtering logic provided by the SpEL expression (uses built-in Regex support) defined by 'mail-filter-expression' attribute and only the messages that contain 'foo' in the Subject will be processed. The result of the SpEL expression must be boolean. Messages that did not pass the filtering criteria will not be flagged as SEEN. Also, they will not be retrieved again by this adapter based on work done by #5812
Oleg Zhurakousky commented
Need to make a small change in favor of already existing Regex support in SpEL
Zak commented
Is there a way to filter out incoming email based on sender id in mail-filter-expression . I want to configure an inbound email adapter to be able to process emails only from ending with @something
.org and filter out the rest
Artem Bilan commented
Zak, would be better, if you ask such a question on the http://stackoverflow.com with spring-integration
tag.
JIRA isn't for making help to community.
Thank you!
Iain Porter opened INT-1804 and commented
Affects: 2.0.3
Reference URL: http://forum.springsource.org/showthread.php?p=348274&posted=1#post348274
Issue Links:
5819 Add documentation for IMAP 'message-filter-expression' addressed in #5812