Change the Envelope From Header for apache, php

On an Ubuntu installation, the php sendmail function will send out email as the apache user www-data@servername.domain. This can make the email flag as spam on some mail servers. To get around this edit your php.ini and restart apache.

Edit the php.ini

sudo vi /etc/php5/apache2/php.ini

Edit the following string:

sendmail_path = '/usr/sbin/sendmail -t -i -fno-reply@yourdomain.com -Fno-reply'

Now restart apache:

sudo service apache2 restart