I need to have a script that will help me save the same groups of fresh email and reply mails (suppose from gmail)to it into the database. My choice is IMAP. Right choice i think.
1) i know how to get the total number of unread emails . But how Can i read only the unread ones so that i can save them into db?
2) Suppose the user marks a mail to be unred. i don't like my script to insert it into the db again. How can I track that. I think gmail has some unique identifier to distinguish mails from each other. What is that?
3) Even if any reply email goes into the spam folder, i need to read and insert that into database too.
Thanks in advance .