• Categories

  • Archives

Setting Return-Path in PHP

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('', 'the subject', 'the message', null, '');

In windows envioronment use:
ini_set('sendmail_from', ';

For more information see: