问题
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
then master.cf configuration from
https://thecodingmachine.io/triggering-a-php-script-when-your-postfix-server-receives-a-mail
I'm able to send all outgoing email content to my php script, but how can i only send bounce email to this script ?
Mail sender:
$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 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}
What i am doing wrong ?
Thanks
回答1:
I finally found the solution on https://serverfault.com/questions/322657/how-can-i-route-some-emails-to-a-script-in-postfix.
The answer starting with : "Okay. And now a different approach."
来源:https://stackoverflow.com/questions/55619256/how-to-handle-bounce-email-with-postfix-and-php