问题
I am using camel rout to consume the emails from my inbox folder. But I want to filter out the auto responded emails like out of offices etc.
I see there is a option for to process only unread messages by using option unseen=true
.
The URI that I am using to consume the emails looks like:
pop3://username@host?password=password;delete=true&unseen=true&consumer.delay=60000
回答1:
I think what you're looking for is the searchTerm
property to add to your endpoint URI.
If you want to filter out e-mails with the term Out Of Office in them, your endpoint URI might look like this:
pop3://username@host.com?password=password;delete=true&searchTerm.subjectOrBody=Out+Of+Office&searchTerm.unseen=true
The searchTerm property lets you search on the basis of several other criteria as mentioned below:
- searchTerm.unseen - Whether to limit by unseen mails only
- searchTerm.subjectOrBody - To limit by subject or body to contain the word.
- searchTerm.subject - The subject must contain the word.
- searchTerm.body - The body must contain the word.
- searchTerm.from - The mail must be from a given email pattern.
- searchTerm.to - The mail must be to a given email pattern.
- searchTerm.fromSentDate/toSentDate - Filters on sent date
Further documentation can be found here - http://camel.apache.org/mail.html
来源:https://stackoverflow.com/questions/25566011/camel-route-to-filter-out-the-auto-response-emails