How can I filter then modify e-mails using IMAP?

Posted by swolff1978 on Stack Overflow See other posts from Stack Overflow or by swolff1978
Published on 2009-08-14T19:54:22Z Indexed on 2010/03/22 9:01 UTC
Read the original article Hit count: 178

Filed under:

I have asked this question in a different post here on SO:

How can a read receipt be suppressed?

I have been doing some research of my own to try and solve this problem and accessing the e-mail account via IMAP seems like it is going to be a good solution. I have successfully been able to access my own Inbox and mark messages as read with no issue. I have been asked to preform the same task on an Inbox that contains over 23,000 emails. I would like to run the test on a small amount of e-mails from that inbox before letting the whole 23,000 get it.

Here is the code I have been running via telnet:

. LOGIN [email protected] password
. SELECT Inbox
. STORE 1:* flags \Seen  'this line marks all the e-mails as read

So my question is how can i execute that store command on a specific group of e-mails... say emails that are going to / coming from a specific account? Is there a way to like concatenate the commands? like a FETCH then the STORE? Or is there a better way to go about getting a collection of e-mails based on certain criteria and then modifying ONLY those e-mails that can be accomplished through IMAP?

© Stack Overflow or respective owner

Related posts about imap