使用 PHP 处理退回邮件?

发布于 2024-07-25 11:00:17 字数 1119 浏览 4 评论 0原文

这是我的情况:

我有 2 个电子邮件帐户: [email protected][电子邮件受保护]

我想使用 [email protected] 向所有用户发送电子邮件,但随后“回复”[电子邮件受保护](直到这里,我的 PHP 脚本可以处理它)。

如果电子邮件无法发送,则会发送至 [电子邮件受保护],错误消息可能是 553(不存在的电子邮件...)等。

我的问题是:如何将所有这些退回电子邮件(无法发送电子邮件)定向到 [email protected] 通过处理脚本检查退回错误代码?

我应该使用什么编程语言来“处理脚本”?

“处理脚本”会是什么样子? 你能给一个样品吗?

换句话说:

我应该遵循哪些程序来处理退回电子邮件?

Here is my scenario:

I have 2 email accounts: [email protected] and [email protected].

I want to send email to all my users with [email protected] but then "reply to" [email protected] (until here, my PHP script can handle it).

When, the email can't be sent, it's sent to [email protected], the error message could be 553 (non existent email ...) etc.

My question is: How do I direct all those bounce emails (couldn't-sent emails) to [email protected] through a handling script to check for the bounce error codes?

What programming language should I be using for the "handling script"?

What would the "handling script" look like? Can you give a sample?

in other words:

What are the procedures I should follow to handle the bounce email ?

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

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

发布评论

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

评论(14

静谧 2024-08-01 11:00:17

最好的场景是能够对弹跳类型进行分类:软弹跳、硬弹跳……

我们使用的是 BounceStudio 。 您需要编译它并添加 php 库...一点也不难。 您就拥有该产品的免费和付费版本

一旦我们检测到 某种退回 我们使用 PEAR::MAIL::MIME 来搜索我们之前添加到电子邮件中的自定义标头,可以说:

X-user-id: XXXXX
X-campaign-id: YYYYYY 
X-recipient-id: SSSSSSSSS

在此这样我们就可以知道我们发送电子邮件的真正收件人。

希望这对你有帮助! 这样你就可以帮助我获得 500 分 :P

The best scenario is be able to classify the type of bounce: soft, hard...

what we use is BounceStudio. You need to compile it and add the php libraries... not hard at all. You have the free and paid version of that product

once we detect the kind of bounce we use PEAR::MAIL::MIME to search for custom headers that we added previously to the email, lets say:

X-user-id: XXXXX
X-campaign-id: YYYYYY 
X-recipient-id: SSSSSSSSS

in this way we can know the real recipient that we sent the email to.

hope this help you! so you can help me to get to the 500 points :P

风和你 2024-08-01 11:00:17

为什么不创建一个 [email protected] 并使用 php 来 阅读这些电子邮件并做你想做的事?

在发表评论后编辑:请检查我的链接,其中有一个 php 脚本,它将教您如何使用 php 打开电子邮箱并阅读电子邮件。 您可以使用此脚本来检查错误消息。

Why not create a [email protected] and use php to read those emails and do what ever you want?

Edit After your comment : Please chec my link whcih has a php script which will teach you how to open and email box using php and read the emails. You can use this scrip to check the error messages.

神也荒唐 2024-08-01 11:00:17

让电子邮件退回到一个真正的电子邮件地址(带有登录详细信息等)。

制作一个每 x 分钟运行一次的 php 脚本(例如使用 cron 作业)。 该 php 脚本必须执行以下操作。
- 从邮箱中检索所有电子邮件(例如使用 Zend Mail
- 检查消息中的错误(例如通过使用正则表达式搜索)
- 做必要的事情。

如果您想具体了解谁退回了,您可以使用用户特定的退回地址。 (例如,请参阅此网站

Let the emails bounce to an address that is really an emailadress (with login details etc.).

Make a php script which runs ever x minutes (for example with a cron job). This php script must do the following.
- Retrieve all email from the box (use for example Zend Mail)
- Check for the error in the message (e.g. by searching it with regular expressions)
- Do what ever is necessary.

If you want to know specifically who has bounced back you can use user specific bounce addresses. (See for example this site)

一个人的旅程 2024-08-01 11:00:17

也许现在得到答案有点晚了,但你总是可以尝试一些新的东西。
上周我有一个这样的任务,并使用了 Chris Fortune 的 BOUNCE HANDLER 类,它将反弹分成关联数组 - http://www.phpclasses.org/browse/file/11665.html

这将在你用一些邮件程序连接到 POP3 并从中获取退回邮件后使用,然后以此将其解析为碎片,如果具有您搜索的状态,请执行必要的操作。

干杯。

Maybe it's a little late for the answer, but you can always try something new.
I had the last week a task like this, and used BOUNCE HANDLER Class, by Chris Fortune, which chops up the bounce into associative arrays - http://www.phpclasses.org/browse/file/11665.html

This will be used after you connect to the POP3 with some mailer to get the bounces from it, then parse it into pieces with this, and if has the status you searched for, do the necessary actions.

Cheers.

因为看清所以看轻 2024-08-01 11:00:17

If you've got a POP3 mailbox set up for [email protected], you could use a POP3 client script written in PHP to retrieve the messages and check for undeliverable messages.

中二柚 2024-08-01 11:00:17

您可以使用 imap_open 从 PHP 访问您的邮件。

此功能也适用于 POP3,但并非所有功能都适用。 不过我想 2018 年大多数电子邮件客户端应该支持 IMAP。

此函数还可用于打开 POP3 和 NNTP 的流
服务器,但某些功能和特性仅在 IMAP 上可用
服务器。

这是一个小例子,如何迭代您的电子邮件:

  /* connect to server */
  $hostname = "{$your-server:$your-port}INBOX";
  $username = 'my-username';
  $password = '123';

  /* try to connect */
  $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to mailbox: ' . imap_last_error());

  /* grab emails */
  $emails = imap_search($inbox,'ALL');

  /* if emails are returned, cycle through each... */
  if($emails) {
    /* for every email... */
    foreach($emails as $email_number) {

        $message = imap_body($inbox,$email_number,2);
        $head    = imap_headerinfo($inbox, $email_number,2);
        // Here you can handle your emails
        // ...
        //  ...
      }
  }

就我而言,我知道我总是从 [电子邮件受保护]。 所以我可以识别这样的反弹:

if($head->from[0]->mailbox == 'Mailer-Daemon')
{
  // We have a bounce mail here!
}

你说:

当电子邮件无法发送时,它会发送到 [电子邮件受保护]
错误消息可能是 553(不存在的电子邮件...)等。

因此,如果您的退回电子邮件的主题为“邮件发送失败:错误 553”,那么您可以通过主题来识别它们,如下所示:

if($head->subject == 'Mail delivery failed: Error 553')
{
  // We have a bounce mail here!
}

失败的电子邮件地址不在header,因此您需要使用一些智能代码从 $message 变量中解析它。

You can use imap_open to access your mails from PHP.

This functions also works for POP3 but not every function may work here. However I guess in 2018 most email-clients should support IMAP.

This function can also be used to open streams to POP3 and NNTP
servers, but some functions and features are only available on IMAP
servers.

Here is a little example, how to iterate through your emails:

  /* connect to server */
  $hostname = "{$your-server:$your-port}INBOX";
  $username = 'my-username';
  $password = '123';

  /* try to connect */
  $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to mailbox: ' . imap_last_error());

  /* grab emails */
  $emails = imap_search($inbox,'ALL');

  /* if emails are returned, cycle through each... */
  if($emails) {
    /* for every email... */
    foreach($emails as $email_number) {

        $message = imap_body($inbox,$email_number,2);
        $head    = imap_headerinfo($inbox, $email_number,2);
        // Here you can handle your emails
        // ...
        //  ...
      }
  }

In my case, I know that I always get my mail delivery failed from [email protected]. So I could identify bounces like that:

if($head->from[0]->mailbox == 'Mailer-Daemon')
{
  // We have a bounce mail here!
}

You said:

When, the email can't be sent, it's sent to [email protected], the
error message could be 553 (non existent email ...) etc.

So if your bounce emails have the subject "Mail delivery failed: Error 553" then you could identify them by the subject like this:

if($head->subject == 'Mail delivery failed: Error 553')
{
  // We have a bounce mail here!
}

The failed email address is not in the header, so you need to parse it from the $message variable with some smart code.

紫罗兰の梦幻 2024-08-01 11:00:17

您始终可以使用 http://cloudmailin.com 之类的内容通过 http 将退回的电子邮件转发到您的 php 服务器,但是您可以使用专门用于发送电子邮件并使用其 api 检索退回邮件详细信息的服务可能会更好。

You could always use something like http://cloudmailin.com to forward the bounced emails on to your php server via http however you may be better with a service dedicated to sending emails and using their api to retrieve the bounce details.

↘紸啶 2024-08-01 11:00:17

我在寻找 PHP 解决方案时运气很差,但我遇到了这个产品,它能满足我的需要。

它作为本地应用程序 mac/win 运行,但它完成了工作。

http://www.maxprog.com/site/software /internet-marketing/email-bounce-handler_sheet_us.php

i have had pretty bad luck looking for a PHP solution for this, but i ran across this product that does just what i needed.

it runs as a native app mac/win but it does the job.

http://www.maxprog.com/site/software/internet-marketing/email-bounce-handler_sheet_us.php

相对绾红妆 2024-08-01 11:00:17

我正在寻找同一问题的答案。 问题的部分更多,选项也更多。

为了处理退回的电子邮件,我找到了 PHP 类,纯粹用 PHP 编写,如果您有 PHP 驱动的站点,则无需编译或安装其他软件。 这是非常容易使用。

如果您使用 cPanel 或 InterWorx/SiteWorx,您可以配置一些地址以使用脚本(例如 PHP 脚本)处理收到的电子邮件,这样您就可以借助上述类编写自己的处理。 当然,您仍然可以创建普通电子邮件帐户并通过 POP3 或 IMAP 检索邮件,然后解释它们。 我认为第一个更好,因为它是直接的,您不必使用额外的渠道,例如 IMAP。 当然,如果您无法配置邮件服务器,或者不知道如何配置,那么前者更适合您。

祝你好运! :)

I was searching for the answer to the same question. There are more parts of the question, and more options.

For handling the bounced e-mail, I found a PHP class, purely in PHP, no compile or additional software installation needed if you have a PHP powered site. It is very easy to use.

If you are using cPanel, or InterWorx/SiteWorx, you can configure some of the addresses to handle the received e-mails with a script, for example a PHP script, so you can write your own handling with the aid of the mentioned class. Or of course still you can create ordinary e-mail accounts and retrieve the mails via POP3 or IMAP, and then interpret them. I think the first one is better, because it's direct, you don't have to use additional channels, like IMAP. Of course if you can't configure your mail server, or don't know how to do it, then the former is better for you.

Good luck! :)

时光匆匆的小流年 2024-08-01 11:00:17

在 php 邮件命令 http://php.net/mail 中,

使用第五个参数并添加“-f”到它。

因此,您使用“-f [email protected]”作为

参数phpList 时事通讯管理器 使用它来管理退回邮件。

一旦邮箱中的退回邮件填满,您就可以将其弹出并进行处理。 这是处理它们的最简单方法,而不是在它们到达时处理它们。

In the php mail command http://php.net/mail

you use the fifth parameter and add "-f" to it.

So, you use "-f [email protected]" as the parameter

the phpList newsletter manager uses this to manage bounces.

Once the bounces fill up in the mailbox, you can POP them, and process them. That's the easiest way to deal with them, as opposed to handling them when they arrive.

失眠症患者 2024-08-01 11:00:17

这是使用 IMAP 处理退回邮件的固定解决方案。

我将 Mail 实例的 Return-Path 标头更改为专用的 [email protected]

我认为唯一可行的简单方法是以下方法,它通过 POP3 检查专用收件箱,并可以根据收到的消息处理每封电子邮件。

$inst=pop3_login('mail.xxxxxx.us','110','[email protected]','pass');
$stat=pop3_stat($inst);
//print_r($stat);
if($stat['Unread']>0){
    echo "begin process<br><br>";
    $list=pop3_list($inst);
    //print_r($list);
    foreach($list as $row){
        if(strpos($row['from'],'MAILER-DAEMON')!==FALSE){
            $msg=imap_fetchbody($inst,$row['msgno'],'1');
            if(strpos($msg,'550')!==FALSE){
                echo "handle hard bounce".$msg."<br><br>";
                //WHATEVER HERE TO PROCESS BOUNCE
            }   
        }
        else{
            $msg=imap_fetchbody($inst,$row['msgno'],'1');
            echo "not from my server. could be spam, etc.".$msg."<br><br>";
            //PROBABLY NO ACTION IS NEEDED
        }   
        //AFTER PROCESSING
        //imap_delete ( resource $imap_stream , int $msg_number [, int $options = 0 ] )
        //commented out because I havent implemented yet. see IMAP documentation
    }   
}   
else{
    echo "no unread messages";  
}


//imap_close ( resource $imap_stream [, int $flag = 0 ] )
//commented out because I havent implemented yet. see IMAP documentation.
//flag: If set to CL_EXPUNGE, the function will silently expunge the mailbox before closing, removing all messages marked for deletion. You can achieve the same thing by using imap_expunge()




function pop3_login($host,$port,$user,$pass,$folder="INBOX",$ssl=false) 
{ 
    $ssl=($ssl==false)?"/novalidate-cert":""; 
    return (imap_open("{"."$host:$port/pop3$ssl"."}$folder",$user,$pass)); 
} 
function pop3_stat($connection)        
{ 
    $check = imap_mailboxmsginfo($connection); 
    return ((array)$check); 
} 
function pop3_list($connection,$message="") 
{ 
    if ($message) 
    { 
        $range=$message; 
    } else { 
        $MC = imap_check($connection); 
        $range = "1:".$MC->Nmsgs; 
    } 
    $response = imap_fetch_overview($connection,$range); 
    foreach ($response as $msg) $result[$msg->msgno]=(array)$msg; 
        return $result; 
} 
function pop3_retr($connection,$message) 
{ 
    return(imap_fetchheader($connection,$message,FT_PREFETCHTEXT)); 
} 
function pop3_dele($connection,$message) 
{ 
    return(imap_delete($connection,$message)); 
} 

Here is a canned solution to process bounces using IMAP.

I changed the Return-Path header of my Mail instance to a dedicated [email protected]

The only method easy enough for me to consider viable is the following, which checks via POP3 the dedicated inbox and can handle each email based on the message received.

$inst=pop3_login('mail.xxxxxx.us','110','[email protected]','pass');
$stat=pop3_stat($inst);
//print_r($stat);
if($stat['Unread']>0){
    echo "begin process<br><br>";
    $list=pop3_list($inst);
    //print_r($list);
    foreach($list as $row){
        if(strpos($row['from'],'MAILER-DAEMON')!==FALSE){
            $msg=imap_fetchbody($inst,$row['msgno'],'1');
            if(strpos($msg,'550')!==FALSE){
                echo "handle hard bounce".$msg."<br><br>";
                //WHATEVER HERE TO PROCESS BOUNCE
            }   
        }
        else{
            $msg=imap_fetchbody($inst,$row['msgno'],'1');
            echo "not from my server. could be spam, etc.".$msg."<br><br>";
            //PROBABLY NO ACTION IS NEEDED
        }   
        //AFTER PROCESSING
        //imap_delete ( resource $imap_stream , int $msg_number [, int $options = 0 ] )
        //commented out because I havent implemented yet. see IMAP documentation
    }   
}   
else{
    echo "no unread messages";  
}


//imap_close ( resource $imap_stream [, int $flag = 0 ] )
//commented out because I havent implemented yet. see IMAP documentation.
//flag: If set to CL_EXPUNGE, the function will silently expunge the mailbox before closing, removing all messages marked for deletion. You can achieve the same thing by using imap_expunge()




function pop3_login($host,$port,$user,$pass,$folder="INBOX",$ssl=false) 
{ 
    $ssl=($ssl==false)?"/novalidate-cert":""; 
    return (imap_open("{"."$host:$port/pop3$ssl"."}$folder",$user,$pass)); 
} 
function pop3_stat($connection)        
{ 
    $check = imap_mailboxmsginfo($connection); 
    return ((array)$check); 
} 
function pop3_list($connection,$message="") 
{ 
    if ($message) 
    { 
        $range=$message; 
    } else { 
        $MC = imap_check($connection); 
        $range = "1:".$MC->Nmsgs; 
    } 
    $response = imap_fetch_overview($connection,$range); 
    foreach ($response as $msg) $result[$msg->msgno]=(array)$msg; 
        return $result; 
} 
function pop3_retr($connection,$message) 
{ 
    return(imap_fetchheader($connection,$message,FT_PREFETCHTEXT)); 
} 
function pop3_dele($connection,$message) 
{ 
    return(imap_delete($connection,$message)); 
} 
聊慰 2024-08-01 11:00:17

我们正在使用 Procmail 来过滤此类邮件。 在检查了此处已经提到的一些解决方案之后,我们最终得到了一个简单的 Procmail 配方来检测退回邮件。 根据您需要的准确性,这可能适用于您的情况。

有关详细信息,请查看此博客条目

We are using Procmail to filter these kind of mails. After examining some of the solutions already mentioned here, we ended up with a simple Procmail recipe to detect bounce messages. Depending on the accuracy you need, this might be applicable to your situation.

For details, check this blog entry.

幸福%小乖 2024-08-01 11:00:17

我有同样的问题,确切的情况。 默认情况下,我的邮件服务器将所有返回的邮件发送到最初发送邮件的同一帐户,并自动发送消息“邮件发送失败:将消息返回给发件人”

我真的不想知道为什么它被退回,有这么多的邮件交易,我只想删除坏的。 没有时间检查特定规则,例如不存在、不可用等,,,只想标记删除并继续。

退回邮件非常琐碎,因为您需要处理许多不同的服务器和响应类型。 每个反垃圾邮件软件或操作系统方案都可以在退回的电子邮件中发送不同的错误代码。

我建议您阅读并下载来自 KIDMOSES 的处理退回邮件 - 使用 PHPMAILER-BMH 和 AUTHSMTP 的已修复调试版本 http://www.kidmoses.com/blog-article.php?bid=40 如果您想设置 IMAP 并发送您自己的自定义标头,将它们发送到您的[电子邮件受保护] 并然后祈祷脚本是否捕获您发送的退回邮件中写入的标头。 我试过了,有效。

但如果您想遵循我的快速简单的解决方案来解决我的问题,这就是秘密。

1 - 从 KIDMOSES 网站或我的网站下载更好的版本,以防万一 KIDMOSES 想要搬到其他地方 http://chasqui.market/downloads/KIDMOSES-phpmailer-bmh.zip

2 - 包含返回邮件文本的变量是 $body,它本身包含错误的返回电子邮件(所以它是一个多维的大批 )。 (还包含您的服务器邮件和其他 DNS 邮件内容,但我们正在寻找退回的坏邮件。3

- 由于您自己的服务正在向您发送退回的电子邮件,因此它不太可能更改其格式和自己的标头,发送回退回的电子邮件,因此您可以安全地选择退回的电子邮件数组的顺序,在我的情况下始终是相同的格式模板(除非您更改系统或提供商)

4 - 我们会调查该 $body。并搜索所有电子邮件字符串变量并将它们提取到名为 $matches二维数组

5 - 我们通过使用 打印数组来选择数组位置print_r( array_values( $matches ));

6 - 这是您需要修改的代码,位于 class.phpmailer-bmh.php 文件的第 500 行左右,

  // process bounces by rules
  $result = bmhDSNRules($dsn_msg,$dsn_report,$this->debug_dsn_rule);
} elseif ($type == 'BODY') {
  $structure = imap_fetchstructure($this->_mailbox_link,$pos);
  switch ($structure->type) {
    case 0: // Content-type = text
      $body = imap_fetchbody($this->_mailbox_link,$pos,"1");
      $result = bmhBodyRules($body,$structure,$this->debug_body_rule);

      //MY RULE IT WORKS at least on my return mail system..
      $pattern = '/[a-z0-9_\-\+]+@[a-z0-9\-]+\.([a-z]{2,3})(?:\.[a-z]{2})?/i';
      preg_match_all($pattern, $body, $matches);
        //print_r( array_values( $matches ));     //To select array number of bad returned mail desired, usually is 1st array $matches[0][0]          
        echo "<font color = red>".$matches[0][0]."</font><br>";
      break;

因此我们忘记了返回的内容。您可以对它们进行优化,也可以对它们进行 MySQL 处理,或者对它们进行处理

重要
注释示例目录中的callback_echo.php 中的回声,否则在打印之前您会得到所有垃圾。

function callbackAction ($msgnum, $bounce_type, $email, $subject,      $xheader, $cheader, $remove, $rule_no=false, $rule_cat=false, $rule_msg='', $totalFetched=0) {
  $displayData = prepData($email, $bounce_type, $remove);
  $bounce_type = $displayData['bounce_type'];
  $emailName   = $displayData['emailName'];
  $emailAddy   = $displayData['emailAddy'];
  $remove      = $displayData['remove'];
  //echo "<br>".$msgnum . ': '  . $rule_no . ' | '  . $rule_cat . ' | '  . $bounce_type . ' | '  . $remove . ' | ' . $email . ' | '  . $subject . ' | ';
  //echo 'Custom Header: '  . $cheader . " | ";
  //echo 'Bounce Message: '  . $rule_msg . " | ";
  return true;
}

我的输出

Connected to: mail.chasqui.market ([email protected])
Total: 271 messages 
Running in disable_delete mode, not deleting messages from mailbox

[email protected]

...

[email protected]

Closing mailbox, and purging messages
Read: 271 messages
0 action taken
271 no action taken
0 messages deleted
0 messages moved

I had the same problem, exact situation. By default my mail server, is sending all my returned mails to the same account that it was originally sent from, with automatic msg "Mail delivery failed: returning message to sender".

I dont really want to know why it was returned, had so many mails transactions that I just want to remove the bad ones. Dont have time to check specific rule such as Doestn Exist, Unavailable, etc ,,, Just want to flag for deletion and go on.

Bounce mails are so trivial as you need to deal with a lot of different servers and responses types. Each anti spam software or operating system scenario can send a different error code with the bounced email.

I recomend you to read and download this fixed debugged version of Handling Bounced Email - USING PHPMAILER-BMH AND AUTHSMTP from KIDMOSES here http://www.kidmoses.com/blog-article.php?bid=40 if you want to setup IMAP and and send your own custom headers, send them to your [email protected] and then cross your fingers to see if the script catches the headers you sent written in the bounced mail. I tried it, works.

But if you want to follow my quick and easy fix that resolved my problem, here is the secret.

1 - Download the better version from KIDMOSES site or from my site, just in case KIDMOSES want to move somewhere else http://chasqui.market/downloads/KIDMOSES-phpmailer-bmh.zip

2 - The variable that contains the text of your returned mail is $body and itself contains the bad returned email (SO ITS AN MULTIDIMENSIONAL ARRAY ). (Also contains your servers mail and other DNS mails stuff, but we are looking for the BAD MAIL BOUNCED.

3 - Since your OWN SERVICE is sending you back the bounced email, then its not likely to change its format and own headers, sending back bounced emails, so you are safe to pick the order of bounced email array returned. In my case was always the same format template. (Unless you change systems or providers)

4 - We look into that $body and search for all email string variables and extract them positioning them into a two dimensional array called $matches

5 - We select the array position, by printing the array using print_r( array_values( $matches ));

6 - This is the code that you need to modify. Its around line 500 from class.phpmailer-bmh.php file

  // process bounces by rules
  $result = bmhDSNRules($dsn_msg,$dsn_report,$this->debug_dsn_rule);
} elseif ($type == 'BODY') {
  $structure = imap_fetchstructure($this->_mailbox_link,$pos);
  switch ($structure->type) {
    case 0: // Content-type = text
      $body = imap_fetchbody($this->_mailbox_link,$pos,"1");
      $result = bmhBodyRules($body,$structure,$this->debug_body_rule);

      //MY RULE IT WORKS at least on my return mail system..
      $pattern = '/[a-z0-9_\-\+]+@[a-z0-9\-]+\.([a-z]{2,3})(?:\.[a-z]{2})?/i';
      preg_match_all($pattern, $body, $matches);
        //print_r( array_values( $matches ));     //To select array number of bad returned mail desired, usually is 1st array $matches[0][0]          
        echo "<font color = red>".$matches[0][0]."</font><br>";
      break;

So we forget about returned headers and concentrate on the bad emails. You can excel them, you can MySQL them, or process to whatever you want to do.

IMPORTANT
Comment the echos in callback_echo.php in the samples directory otherwise you get all the junk before printed.

function callbackAction ($msgnum, $bounce_type, $email, $subject,      $xheader, $cheader, $remove, $rule_no=false, $rule_cat=false, $rule_msg='', $totalFetched=0) {
  $displayData = prepData($email, $bounce_type, $remove);
  $bounce_type = $displayData['bounce_type'];
  $emailName   = $displayData['emailName'];
  $emailAddy   = $displayData['emailAddy'];
  $remove      = $displayData['remove'];
  //echo "<br>".$msgnum . ': '  . $rule_no . ' | '  . $rule_cat . ' | '  . $bounce_type . ' | '  . $remove . ' | ' . $email . ' | '  . $subject . ' | ';
  //echo 'Custom Header: '  . $cheader . " | ";
  //echo 'Bounce Message: '  . $rule_msg . " | ";
  return true;
}

MY OUTPUT

Connected to: mail.chasqui.market ([email protected])
Total: 271 messages 
Running in disable_delete mode, not deleting messages from mailbox

[email protected]

...

[email protected]

Closing mailbox, and purging messages
Read: 271 messages
0 action taken
271 no action taken
0 messages deleted
0 messages moved
星軌x 2024-08-01 11:00:17

你应该看看 SwiftMailer。 它完全用 PHP 编写,并支持“退回”电子邮件。
http://swiftmailer.org/

You should look at SwiftMailer. It's completely written in PHP and has support for "bounce" emails.
http://swiftmailer.org/

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