如何使用postfix和php处理退回电子邮件?

问题描述 投票:0回答:1

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

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

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

然后从master.cf配置

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

我能够将所有传出的电子邮件内容发送到我的php脚本,但是我怎样才能将反弹电子邮件发送到此脚本?

邮件发件人:

$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
$headers[] = 'Reply-To: [email protected]';
$headers[] = 'Return-Path: [email protected]';
$headers[] = 'From: Example <[email protected]>'


mail('Example <[email protected]>', "subject", "msg", implode("\r\n", $headers), "-f [email protected]");

master.cf pickup将所有外发电子邮件发送到example.php。我试图使用弹跳而不是拾取,但没有成功。

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}

我做错了什么?

谢谢

php debian postfix-mta bounce
1个回答
0
投票

我终于找到了https://serverfault.com/questions/322657/how-can-i-route-some-emails-to-a-script-in-postfix的解决方案。

答案开始于:“好的。现在采用不同的方法。”

© www.soinside.com 2019 - 2024. All rights reserved.