IMAP:从gmail获取电子邮件 [英] IMAP: Getting emails from gmail

查看:126
本文介绍了IMAP:从gmail获取电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从gmail获取电子邮件,但我想获取所有邮件"文件夹

I want to get emails from gmail, but I want to get the folder 'All Mail'

我有以下内容:

$server = '{imap.gmail.com:993/ssl}';
$user = 'myUser';
$password = 'myPassword';
$connection = imap_open($server, $user, $password);
$count = imap_num_msg($connection);
echo $count;

但是回显仅回显收件箱中的电子邮件,如何使它读取某个文件夹或所有文件夹?

The echo however is echoing the emails in the inbox only, how can I make it read a certain folder, or all the folders?

谢谢!

推荐答案

使用它来获取所有邮件:

Use this to get all mail:

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

我们转了一圈又一圈;看到这里:

We went round and round on this awhile; see here:

https://stackoverflow.com/a/8178514/776695

如此处所述,使用imap_list查看可用的单个文件夹

As stated here, use imap_list to see which individual folders are available

这篇关于IMAP:从gmail获取电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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