I have a fresh Ubuntu 11 server installation with the LAMP stack installed. When I sent e-mail thru PHP, the message never left the server.
I believe there is a more kosher way to do this, but this is what worked for me.
=> Modify /etc/mail/sendmail.cf
=> Locate the lines that say:
# “Smart” relay host (may be null)
=> Edit the DS line like so:
Restart the services… good to go.