IMAP& PHP-从已发送和收件箱文件夹中获取所有电子邮件 [英] IMAP & PHP - Fetching all emails from sent and inbox folders

查看:415
本文介绍了IMAP& PHP-从已发送和收件箱文件夹中获取所有电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取所有已接收和发送的电子邮件,并使用PHP将其写入mySQL数据库.

I am trying to fetch any emails received and sent, and write it to the mySQL database using PHP.

我使用的主机名是:

$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';

哪个仅引用收件箱,并且成功地仅抓取收到的电子邮件.

Which is referencing just the inbox, and successfully grabs just emails received.

要抓取已发送的电子邮件,我正在尝试使用此主机名:

To grab emails sent, I am trying to use this hostname:

$hostname = '{imap.gmail.com:993/imap/ssl}[Gmail]/All Mail';

通过将"INBOX"替换为"[Gmail]/所有邮件",没有电子邮件(甚至没有发送)并被退回.

By replacing "INBOX" with "[Gmail]/All Mail", no emails (not even sent) and being returned.

我该如何抓取所有发送和接收的电子邮件?

How do I grab all emails sent and received?

推荐答案

您可能需要在两个呼叫(收件箱和已发送邮件)中执行此操作.根据这篇文章: GMAIL发送的文件夹无法使用IMAP进行访问,已发送邮件文件夹称为[gmail]/sent mail

You probably need to do this in two calls, inbox and sent items. According to this post: GMAIL sent folder not accessible using IMAP, the sent items folder is called [gmail]/sent mail

这篇关于IMAP& PHP-从已发送和收件箱文件夹中获取所有电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆