我想从我的Gmail帐户获取电子邮件。我确实使用了该代码,但除了没有停止循环之外,屏幕上没有显示任何内容。我不明白我错在哪里,因为我的港口是正确的。我还在我的GMAIL account
中启用了IMAP设置。我正在使用Windows 7,请帮我解决这个问题。想要从gmail收取电子邮件
$server = '{imap.gmail.com:993/ssl}';
$connection = imap_open($server, '[email protected]', 'abc');
$emails = imap_search($connection,'UNSEEN');
if($emails) {
rsort($emails);
foreach($emails as $email_number) {
$overview = imap_fetch_overview($connection,$email_number,0);
print_r($overview);
echo $overview[0]->subject."\n";
$message = imap_fetchbody($connection,$email_number,1);
echo $message;
}
}
/* close the connection */
imap_close($connection);
它不工作。我已经实现了这一点。 – user1790377
什么是循环?请注意,您的示例中没有指定“图像”或“INBOX”。 – doublesharp
我不明白什么是循环。我从今天起就搞砸了这段代码。请帮帮我。至少告诉我我错在哪里? – user1790377