开发者

how to save gmail emails accordingly in database

开发者 https://www.devze.com 2023-03-23 09:14 出处:网络
i want to have a script that will save gmail emails from an account in mysql dbusing php. Mails(both freshly new and reply ones) will be开发者_如何学编程 marked to be in the same category if they have

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消