Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help searching imap folder for multiple recipients

 
Ryan Stille
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I'm extremely green to Java. If this is not the right forum for this question, I apologize.

I'm trying to search an imap folder based on the recipient addresses. I've got this partially working by reading through Sun's javadocs for the Folder class.

The problem is I want to search all recipients, not just one of TO, CC, or BCC. I don't see a way to do this, other than do three separate searches, then add all the arrays (of messages) together and filter out the duplicates. Is there a more elegant way? The search() method only accepts one searchTerm, so I don't see how I would do it.

-thanks
[ August 09, 2008: Message edited by: Ryan Ryan ]
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Ryan Ryan",

Please read your private messages regarding an important announcement.

Thank you,

Rob
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've looked at the API, and the search method takes a SearchTerm. Now I bet you are using RecipientTerm, with one of the types, right?

Now that one is just what you need, in combination with OrTerm:

This will return all messages that have the address as the TO, CC or BCC.

Of course the same applies to RecipientStringTerm. In fact, you can put any term you want in the OR.
 
Ryan Stille
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you that was so helpful!

I was using RecipientStringTerm, and I hadn't even thought about trying to use the OrTerm.

thanks!
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!