This guide explains how to properly connect Mailgun to a WordPress website to ensure reliable email delivery for forms, notifications, and system emails.
WordPress sends emails using the server’s default mail function, which is often unreliable. Emails may:
Mailgun is a professional email delivery service that solves these issues by providing:
To connect Mailgun to WordPress, you will:
Go to:
https://www.mailgun.com
Sign up or log in to your account.
Inside Mailgun:
Use a subdomain (recommended):
Example:
mg.yourdomain.com
Select region (US or EU), then click Add Domain.
Mailgun will provide DNS records you must add to your domain.
These typically include:
Host: mg
Value: v=spf1 include:mailgun.org ~all
Host: k1._domainkey.mg
Value: (long key provided by Mailgun)
Host: mg
Value: mxa.mailgun.org (Priority 10)
Host: mg
Value: mxb.mailgun.org (Priority 10)
Host: email.mg
Value: mailgun.org
⚠️ Important:
After adding records, return to Mailgun and click Verify DNS.
Install the plugin:
In WordPress:
Go to:
WP Mail SMTP → Settings
Set:
Mailer: Mailgun
API Key: your Mailgun API key
Domain: mg.yourdomain.com
Region: US or EU
Save settings.
Go to:
WP Mail SMTP → Tools → Email Test
Send a test email to verify configuration.
If successful, Mailgun is correctly connected.
If using Gravity Forms:
Go to:
Forms → Your Form → Settings → Notifications
Set:
From Email: noreply@yourdomain.com
Reply-To: {Email:1} (user email field)
⚠️ Important:
Submit the form and verify:
Connecting Mailgun to WordPress ensures reliable email delivery for forms and notifications. Once configured, it significantly improves email success rate and reduces spam issues.
This setup is especially important for business websites where missing form submissions can lead to lost leads.
Hey everyone! In the first part we agreed: redirects are evil, business logic stays on…
AI has made automation more accessible than ever. Tasks that previously required hours of manual…
Hey everyone! I’m starting a series of articles on integrating payments into a website. If…