【问题标题】:how do i track the bounced emails?我如何跟踪退回的电子邮件?
【发布时间】:2011-07-21 02:21:08
【问题描述】:

我想跟踪从我的服务器发送的退回邮件。看了几篇,发现被退回的邮件是存放在邮箱里的,直接读取邮箱文件就可以检测到。

check for bounced mails with php

现在我想知道如何读取服务器的邮箱文件?发送邮件后是否需要手动运行 php 脚本文件以将退回的电子邮件记录到我的数据库中?是否需要解析邮件内容以查明被退回的邮件?

我的目标是为我的 php 服务器提供流行电子邮件访问权限。

【问题讨论】:

    标签: php email email-bounces


    【解决方案1】:

    这是我在 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;
                }
    
    
            }
    
        }
    
    }
    

    退回的电子邮件地址在邮件正文中,我将其回显到浏览器。

    【讨论】:

      猜你喜欢
      • 2020-08-26
      • 2010-11-01
      • 2011-03-05
      • 1970-01-01
      • 2020-01-14
      • 1970-01-01
      • 2018-11-25
      • 2011-06-02
      • 2011-04-03
      相关资源
      最近更新 更多