[英]how do i track the bounced emails?
我想跟蹤從我的服務器發送的退回電子郵件。 查閱了一些資料,發現退回的郵件都存放在郵箱中,直接讀取郵箱文件就可以檢測到。
現在我想知道如何讀取服務器的郵箱文件? 我是否需要在發送郵件后手動運行 php 腳本文件以將退回的電子郵件記錄到我的數據庫中? 我是否需要解析電子郵件內容以找出被退回的電子郵件?
我的目標是通過流行電子郵件訪問為我的 php 服務器提供內容。
這是我如何連接到 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;
}
}
}
}
退回的電子郵件地址位於郵件正文中,我將其回顯到瀏覽器。
查看以下問答: 使用PHP退回電子郵件處理?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.