Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I send emails using PHP's mail() function from my web app I can deliver e-mails successfully to any e-mail address except to my own Google Apps e-mail account, which happens to be on the same domain the web app is on.

I've read which seems to be my problem, but I don't understand what it's telling me to do. I've also looked at but I'm not sure if that's specific to cpanel or not.

I'm on a VPS with Ubuntu 8.04 Hardy Herron.

Any help would be appreciated, thanks!

share|improve this question
up vote 0 down vote accepted

Most MTAs (mail servers) will not lookup MX records if the local server has email setup for the domain, they will instead deliver locally. Turn off email locally for this domain (or I believe there might be a setting in cpanel to force DNS lookups) and your emails should start working.

share|improve this answer
Do you know how to do this through the shell? I don't have cpanel :-( Thanks – user29403 Aug 9 '10 at 15:56
which mailserver are you using? Likely to be either postfix, qmail or exim – James L Aug 9 '10 at 15:59
I'm using sendmail – user29403 Aug 9 '10 at 16:06
go into each file that grep -R -l "the_email_hostname" /var/mail/* returns and delete the entry for the hostname. – James L Aug 9 '10 at 16:14
Hmm, there;s nothing in /var/mail but a file called www-data which appears to be a log of delivered e-mails – user29403 Aug 9 '10 at 16:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.