php - 如何使用 postfix 和 php 处理退回邮件?
问题描述
使用 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: 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。我尝试使用反弹而不是拾取但没有成功。
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}
我做错了什么?
谢谢
解决方案
我终于在https://serverfault.com/questions/322657/how-can-i-route-some-emails-to-a-script-in-postfix找到了解决方案。
答案以:“好的。现在采用不同的方法。”
推荐阅读
- jquery - SCRIPT1003:IE11 中应为“:”
- java - 检测 URL 打开
- javascript - 如何从 v-textarea 中删除重复的字符串
- java - 在一个函数中增加 count 的值,并在另一个函数中对 count 使用 if 条件
- c++ - 节点上的链表操作(弗洛伊德循环检测)
- python - 使用 BeautifulSoup 抓取网站时出错
- database - 如何在 Cassandra 中将日期类型的值转换为文本?
- c# - 单击空白区域不会触发 ListBox 中的事件
- python - 说明散点图中特定数据点的坐标
- python - Python-MySQL 查询不显示结果,包括同一查询中的先前导入