Question

Email issues - I'm a bit confused

  • Posted June 5, 2014

Hello all :) I’ve set up a WordPress site on my droplet (LAMP, Ubuntu 12.04). I’m also using google apps to handle my email. I have my DNS set up to use gmail, as well.

the problem is with the WordPress site. I’ve set up Postfix (and followed this tutorial to relay gmail: http://mhawthorne.net/posts/postfix-configuring-gmail-as-relay.html) and PHP mail (msmtp) and they seem to be working - especially the PHP mail. All of the tests are coming through just fine. However, I have my google apps email address set as the admin in my WordPress environment, and I have a contact form that’s set to send notifications to that address. I also have the form (uses Gravity Forms) to email a copy of the filled-out form to whatever end user filled it out.

None of those emails are coming through anywhere. It’s like WordPress isn’t connected to any sort of mail setup at all. I tried using a WordPress SMTP plugin, but that also fails with a message:

SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)

There’s a few of my tests that are showing up in my /var/mail folder, but it appears they are postfix error messages - they all say the"user" doesn’t exist (but I set one up, so it should be there). here’s one of the messages, if it helps:

Diagnostic-Code: X-Postfix; unknown user: “shelly”

So I’m kinda stumped as to what I’m doing wrong here. In all honesty, I don’t want to use my droplet for mail at all, I just want to have Gmail/Google Apps handle it completely. If anyone could point me to whatever I’m doing wrong/missing, I’d really appreciate it.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

My suggestion bypasses postfix completely why not use a Wordpress SMTP plugin with a gmail account you create solely for notifications from your site?

I apologize for not coming back to this until now. david294611’s answer was what I did - and it’s working great.

I’m getting ready to add in 2-factor authentication to be sure it still works with that, but so far, I haven’t needed anything but gmail and the SMTP plugin (I’m using this one, if it helps anyone in the future: https://wordpress.org/plugins/wp-mail-smtp/) and all is working perfectly well. Exactly what I wanted.

For the record, the errors in the log files were “unknown user”, even though the user is definitely there. @Alexandre, the “failed to connect to server” was a message from the SMTP plugin, not the error logs. My DNS is fine. I can even send test emails from the command line and they come through - it’s just via WordPress that they don’t.

…and impatience again, I guess. It worked the one time, and now it’s no longer working again. I guess I’ll keep plugging away at it.

Crazy. I guess I’m just impatient! The SMTP plugin is now working just fine. (I’ll also note that a few hours after I sent the test emails, several of them popped through to my inbox.)
<br> <br>I guess all I had to do was give it a couple of hours. <br> <br>Thanks for the suggestions, I appreciate it :)

The error it self is clean enough: “Failed to connect to server”. <br>Now, what that means? Your server couldn’t resolve the provided address name. So the question is: why does it work locally? Because your machine knows itself. <br> <br>A working DNS service is a must to properly do name conversion of provided addresses.

Check postfix’s error logs: <br><pre>tail -30 /var/log/mail.log <br>tail -30 /var/log/mail.err</pre> <br>Do you see any errors in there?