我想要跟踪已从我的服务器发送的退回电子邮件。我读了一些东西,发现退回的电子邮件存储在邮箱中,可以通过直接读取邮箱文件来检测。
check for bounced mails with php
现在我想知道如何读取我的服务器的邮箱文件?我是否需要在发送邮件后手动运行php脚本文件以将退回的电子邮件记录到我的数据库中?我是否需要解析电子邮件内容才能找出被退回的电子邮件?
我的目标是为我的php服务器与pop电子邮件访问的东西。
发布于 2015-09-11 01:33:05
下面是我如何连接到one.com上的接收邮件服务器
$inbox = imap_open('{imap.one.com:993/imap/ssl/novalidate-cert}INBOX', 'your@address.com', 'xxxxxxxx') or die('Cannot connect: ' . print_r(imap_errors(), true));
/* grab emails */
$emails = imap_search($inbox,'ALL');
/* if emails are returned, cycle through each... */
if($emails) {
/* put the newest emails on top */
rsort($emails);
/* for every email... */
foreach($emails as $email_number) {
$message = imap_fetchbody($inbox,$email_number,2);
$pieces = explode(" ", $message);
foreach($pieces as $piece){
$findme = '@';
//$findme2 = '.com';
$pos = strpos($piece, $findme);
if ($pos !== false) {
echo $piece;
}
}
}
}退回的电子邮件地址在邮件正文中,我将其回显到浏览器。
https://stackoverflow.com/questions/5402051
复制相似问题