We have a system that needs to send automated emails. But we were having a problems where we were not getting bounce emails from invalid email addresses.
After half a day of digging it turns out the problem was that the Return-Path header was being set to the user that the web server runs as. Which was a non-existent email address.
To set the Return-Path in PHP on a unix environment use:
mail('nobody@example.com', 'the subject', 'the message', null, '-fwebmaster@example.com');
In windows envioronment use:
ini_set('sendmail_from', 'webmaster@example.com);
For more information see: http://www.php.net/manual/en/function.mail.php
Advertisement
Filed under: Programming