Add this to sendmail.cf:
Originally Posted by banditti
to force it to send on address 126.96.36.199.
You might also want to look into using SPF records for your domains to specify the legitimate sending host(s).
Things get tricky with mail sent from PHP forms. By default, the SMTP envelope sender will be email@example.com unless you have some form of masquerading set up in sendmail. You might want to consider using custom From headers in the PHP mail() command like this:
You'll need to add the apache user to the list in /etc/mail/trusted-users so PHP can rewrite the SMTP sender without generating a warning header.
One other option is to create an entry in /etc/mail/genericstable like this:
Now sendmail should automatically rewrite mail sent by the www-data user to use firstname.lastname@example.org as the SMTP sender. This has less flexibility than the other approach since all your domains will have their mail sent from email@example.com.
echo 'www-data firstname.lastname@example.org' >> genericstable
makemap genericstable < genericstable