I've been trying to send mail through PHP's mail() function to a Google Apps email address, along with other email addresses. I've been successful in sending to my email (MobileMe) and Gmail- but email sent to any address hosted on Google Apps fails. It seems as if the emails I send to Google Apps don't even get into the inbox or even spam folder- it simply isn't there.

Normal email works just fine- I can send email from my mail client just fine to the emails on Google Apps.

I also tried using Swift Mailer slong with a SMTP server instead of PHP's mail() function, but still no luck. Help??

closed as off topic by womble, Shane Madden, Smudge, MDMarra, user9517 May 13 '12 at 20:57

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Are you using the smtp server to send from php and from you normal mail client? If you aren't then that is not a valid test. – Nathan Powell Aug 26 '11 at 1:52
  • Logs will tell you what happened to the e-mail. – womble Aug 26 '11 at 2:26
  • @nathan Yes, I am using the smtp server to send from php. – sman591 Aug 26 '11 at 3:46
  • @womble I feel so dumb not to think of that! Feel free to post as answer- that solved it. – sman591 Aug 26 '11 at 3:47

When diagnosing any delivery problem, your first step needs to be to look to your logs. Most MTAs will log via the mail facility of syslog, which by default will end up in either /var/log/maillog (on RHEL-derived systems) or /var/log/mail.log (Debian-derived systems) -- or quite likely somewhere else entirely on some niche systems. The exception is Exim, which likes to put things in it's own little world somewhere under /var/log/exim.

From there, error messages may or may not be clear, but a subtle use of Google and (at worst) a question here on Server Fault with the error message and context will probably result in a useful outcome.


Gmail is tricky. Make sure you're using the right port. 990 I think. And for the username, it's your ENTIRE email address.

  • 2
    He's sending to email addresses hosted at google, not using their SMTP service to send messages through. – EEAA Aug 26 '11 at 4:37

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