Reputation: 21
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: [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 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
Upvotes: 0
Views: 1660
Reputation: 21
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."
Upvotes: 1