What is the best way to set up domain email? I am having issues with my domain email handled by Google

July 25, 2018 489 views
Apache WordPress Email Ubuntu 16.04

First, know that I am not a coder. I have been trying to learn for a while now but walked away from this for a while. Now I'm back trying to create a new droplet and redo my sites from scratch. I follow tutorials and have managed to learn a few things along the way but not enough - so here I am.

Before I used the Ubuntu 14 with WordPress and my domain email managed by Google Suites. I don't recall any problems getting my same domain email address to send from WordPress back then like from contact forms. This time, with Ubuntu 16, I had forgotten my WordPress admin password (turns out that I was using the wrong one - that's what I get for working on this while tired) and tried to send email to reset it and it would not send. So, I deleted the folders and files and database and recreated the WordPress site. This time I installed a plugin to see if my email was sending from WordPress and it was but was being bounced from Google and not received in my google email app or gmail.google.com in the browser. Sorry, I didn't think to save the message from mail.log and have since destroyed the droplet and getting ready to start fresh again.

Funny thing is, I found a tutorial on how to change the password through the MySQL command line and it changed but I was still unable to log in to my WordPress admin dashboard.

So, this is what I think I know. I believe the droplet is created with Postfix which I understand to be an MTA protocol which sends email from the server. I set up the MX record (per instructions on Google then again with the button that does it automatically in the DO dashboard) for using Google to handle my domain email (example@example.com). My domains are registered inside the Suites admin just fine. I can't see anywhere that changing the IP address affects this but I delete one of them and redid the authorization just in case and it made no difference. I had purchased the domain name from domain.com (a few years back) and went in and stripped all records from there except directing the A record to the new IP address. This didn't seem to make a difference either.

So, is there something I need to do within Postfix? Is Postfix default settings interfering with
Google Suites handing my email with my domain address? Is there another default app in the droplet that I need to edit to be compatible with Google handling my domain email? I've been searching for a couple of days now but can't figure out what I'm missing. Thank you in advance for any help on this matter.

1 Answer

Hello friend!

There is a lot to unpack here, but I think we can simplify it to you wanting your Wordpress to send email with ease. If you remember the days when sending email was a simple thing, I'm sad to say those days are mostly behind us. For that, you can thank email spammers. If you look at someone like Google running the giant system that is Gmail, preventing a tiny fraction of their inbound spam probably saves them from running an entire new rack of hardware. The impact of spam, at scale, is huge. As a result, the efforts taken to reduce inbound spam have become increasingly powerful. This is just one example scenario of how you can end up not having an email delivered:

Let's say you create a droplet named "test." Now you send an email. The two computers briefly converse:

Droplet: Hi, my name is test.
Recipient server: I searched "test" and found that this is not a valid domain name.

Another similar scenario, this time you name it server.domain.com:

Droplet: Hi my name is server.domain.com
Recipient server: I checked DNS for "server.domain.com" and did not receive your IP address in return, therefore you are not server.domain.com.

That speaks to the idea that the droplet has to be given a FQDN to start. That needs to be the hostname for the server, the name of the droplet in the control panel (used to set PTR), and also needs to match an A record on your DNS. This is the basic foundation for a system that sends email, but there is so much more.

To find out why the email isn't being delivered, you might check /var/log/mail.log and see what you find. From there, the reaction is relative to your findings.

To run far away from this headache, and believe me I highly recommend that, you should install a Wordpress plugin that connects to an SMTP server and sends through another service. Something like SendGrid (just example, many more exist) would do great. If you don't want to struggle with this for years to come, I recommend letting someone else take on that burden.

Kind Regards,
Jarland

  • Thanks, what you said makes sense considering I created a new droplet, named it according to my domain name as you stated above and the email sent correctly.

    So, what if I have multiple FQDN's set up in the Apache virtual host file system? How can I get each of them to cooperate with their own admin@eachdomain.com from the same droplet?

    My last droplet had the name of another FQDN of mine but the site was different; I hadn't tried the other one yet. How do I avoid running into the same problem when I set up my other sites with their own domain email? Do I have to create a separate droplet for each to avoid this problem? Is there another way?

  • My comment about FQDN assumes that this fully qualified domain name means I own it (I purchased through domain.com) - if there is something more to that then please explain what FQDN fully means.

    If a plugin is my ownly work around to make each of my sites work with their own admin@domain.com email then I'll look into it for sure.

Have another answer? Share your knowledge.