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 http://www.google.com/support/a/bin/answer.py?hl=en&answer=55299 which seems to be my problem, but I don't understand what it's telling me to do. I've also looked at http://forums.cpanel.net/f43/google-apps-mail-problem-139337.html 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!


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.

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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