i want to have a script that will save gmail emails from an account in mysql db using php. Mails(both freshly new and reply ones) will be开发者_如何学编程 marked to be in the same category if they have the same subject. That is just the same way in gmail or yahoo mail.
So far as I know gmail IMAP does not give the facility to track which are the reply mails.
Which API or whatever should I use??
The script will keep running.
Do I need to use scheduled task for that?
I haven't worked with that, but as i Google around, it turns out GMAIL provides IMAP Extensions API. And there you have an option to Access to the Gmail thread ID: X-GM-THRID
The reply emails as you call them are stored in the sent-mail folder, so just download them with IMAP.
You can track how emails go together using the In-Reply-To:
and References:
headers. Using the subject is not reliable.
@sof_user : every mail will have message_id in the header. google tracing the email with the id, if it is reply, then IN-REPLAY-TO will have the same id.
精彩评论