WP forms and Mailgun


Way too much research needed just to get WP to send emails :-):smile:

I’ve signed up for a mailgun account and have WP SMTP plugin installed so I’m good to go. Having read every post on this forum re mailgun and smtp plugins this seems like the best match, and a better option than using CW SMTP add-on.

In mailgun they recommend using a sub-domain. I guess that is to prevent the root domain being blacklisted? Is it better to use a sub-domain or register a new domain specifically for mailgun? For example, new domain - website@wordpress-generic-mail.com

I can’t get my head around how the emails from each WP app/site/domain will look to my client’s who’s sites I’m hosting. Surely the email should look something like this, website@clients-domain.com rather than website@my-web-design-biz.com or website@wordpress-generic-mail.com?

I thought the whole point is to improve email Authentication. Using website@my-web-design-biz.com or website@wordpress-generic-mail.com? sent from www.clients-domain.com looks spammy?

Help, last step, but I’m suffering from brain freeze :sweat_smile:


I also have had to deal with a similar situation where my client websites are sending emails through an email service provider (ESP). In general, the instructions provided by the ESP are for a single entity sending mail for a single website.

If your client sites are only sending emails to site admins, you’ll have no trouble using a single mail-sending domain (client.site.name@my-web-design-biz.com or client.site.name@wordpress-generic-mail.com).

If your client sites are sending to site users and the messages need to be domain-branded to match the site domain, you have a bit more work to do:

  • Follow ESP instructions to add and configure sending domain of client-domain.com (or webmailer.client-domain.com) in your ESP “Manage Sending Domains” panel
  • Configure SPF and DKIM DNS records at client-domain.com to allow ESP to send and sign on behalf of sending domain (the whole ‘improve authentication’ concern you raised. also improves deliverability). Note you can only have one SPF record per domain (or subdomain) so you may need to update an existing SPF record to include ESP domain or IP. You’ll definitely make a new DKIM record though.
  • Configure WP SMTP to use ESP and force From: email address to website@client-domain.com

Ahhhh… great, thanks, Lucas. That makes the whole process a lot clearer.

In my case, clients and their customers will both receive emails so I need to use the branded-domain method.

I’m still not clear on the benefits of using a sub-domain though?

If you were sending lots of messages (like if you were sending newsletters from a WP plugin) from the root domain, you run the possibility of having your domain reported to Spamassassin and other blocklists.

In that case, you’d want to use something like news.domain.com; If the root domain is reported to blocklists, you run the risk of legitimate email sent by actual people in the company who are sending real emails to customers or contacts being blocked by those blocklist lookups.

This article does a good job of summing up the considerations of domain reputation: https://www.braze.com/blog/email-subdomains/

Thanks Lucas, great article.

Much appreciated.

Hi Lucas,

Am I correct in saying I set-up the subdomains at my domain host control panel, one for each clients domain and then point them to mailgun?

I don’t need to set-up anything related to the subdomains on CW?

No setup required on CW. You will need to configure the website that’s hosted on CW to use the outbound SMTP server info that you get from mailgun.

The WP plugin Post SMTP handles Mailgun natively

Am I correct in saying I set-up the subdomains at my domain host control panel, one for each clients domain and then point them to mailgun?

You don’t really “point” subdomains to Mailgun. (At least, not in the context you’re using them. Officially, you can point MX records to Mailgun if you’re planning to receive inbound mail at the subdomain and then use Mailgun’s webhook forwarding tool, but that’s beyond the scope of what we’re doing here).

What you do do though is to add the required SPF and DKIM records to allow Mailgun to send as those subdomains.

Got it !!!

Thanks for sticking with me.

Cheers, Lucas :smiley: