我如何跟踪退回的电子邮件?

发布于 2024-10-25 18:51:08 字数 315 浏览 4 评论 0原文

我想跟踪从我的服务器发送的退回电子邮件。我看了一些资料,发现退回的邮件都存储在邮箱中,直接读取邮箱文件就可以检测到。

使用 php 检查退回邮件

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

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

I would like to track the bounced emails of that has been sent from my server. I read few stuffs and found that the bounced emails are stored in mailbox and can be detected by reading the mailbox files directly.

check for bounced mails with php

Now i would like to get some idea how do i read the mailbox files of my server? Do i need to run a php script file manually after sending the mail to record the bounced email to my database? Do i need to parse the email contents to findout which email has been bounced?

I am targeting the stuff for my php server with pop email access.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

零度℉ 2024-11-01 18:51:08

以下是我连接到 one.com 的传入邮件服务器的方法。

$inbox = imap_open('{imap.one.com:993/imap/ssl/novalidate-cert}INBOX', '[email protected]', '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;
            }


        }

    }

}

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

Here is how I connect to the incoming mail server at one.com

$inbox = imap_open('{imap.one.com:993/imap/ssl/novalidate-cert}INBOX', '[email protected]', '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;
            }


        }

    }

}

The email address that bounced is in the body of the message and I echo it to the browser.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文