如何使用后缀和php处理退回电子邮件? [英] How to handle bounce email with postfix and php?

查看:118
本文介绍了如何使用后缀和php处理退回电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Postfix和PHP处理退回电子邮件.

Using Postfix and PHP i would like to handle bounce email.

我首先构建一个像这样的后缀服务器:

I first build a postfix server like this :

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-postfix-e-mail-server-with-dovecot

然后从

https://thecodingmachine .io/triggering-a-php-script-when-you-postfix-server-receives a-mail

我能够将所有传出的电子邮件内容发送到我的php脚本,但是我怎么能仅将退回电子邮件发送到此脚本?

I'm able to send all outgoing email content to my php script, but how can i only send bounce email to this script ?

邮件发件人:

$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
$headers[] = 'Reply-To: bounce@example.com';
$headers[] = 'Return-Path: bounce@example.com';
$headers[] = 'From: Example <postmaster@example.com>'


mail('Example <example@example.com>', "subject", "msg", implode("\r\n", $headers), "-f bounce@example.com");

master.cf 取件将所有传出电子邮件发送到example.php. 我试图用弹跳代替接送,但没有成功.

master.cf pickup send all outgoing email to example.php. I tried to use bounce instead of pickup but without success.

pickup    fifo  n       -       -       60      1       pickup
       -o content_filter=myhook:dummy

myhook unix - n n - - pipe
  flags=F user=www-data argv=/var/www/example.php ${sender} ${size} ${recipient}

我做错了什么?

谢谢

推荐答案

我终于在答案始于:好.现在是另一种方法."

The answer starting with : "Okay. And now a different approach."

这篇关于如何使用后缀和php处理退回电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆