How to Mailgun smtp relay
Published October 12, 2024 · Updated August 24, 2026 · SMTP & Deliverability
Mailgun is a developer-favourite email API, and its SMTP relay lets you send through Mailgun's infrastructure using standard SMTP instead of the API. It is a solid option for transactional mail - here is how the Mailgun SMTP relay works, and how it compares to a dedicated SMTP for volume sending.
How the Mailgun SMTP relay works
Rather than integrating the API, you point your app at Mailgun's SMTP host with credentials from your dashboard. Mailgun then authenticates, signs, and delivers your mail on shared or dedicated IPs, depending on your plan.
Setting it up
- Verify your sending domain in Mailgun and add the DNS records it provides.
- Use the SMTP host and port 587 with your Mailgun SMTP credentials.
- Point your app or mailer at those settings and send a test.
API vs. SMTP relay with Mailgun
The API gives you richer features — delivery webhooks, detailed event tracking, templating — and is the better fit if you are building the integration yourself. The SMTP relay is the faster path when you already have an app, plugin, or mailer that only knows how to speak standard SMTP and cannot be rewired to call an API.
How the tiers typically scale
Like most transactional email APIs, Mailgun's plans scale by monthly volume, with dedicated IPs and priority support reserved for higher tiers — meaning the flat, predictable pricing of a dedicated SMTP often becomes more cost-effective once your volume is consistently high rather than occasional.
A quick migration note
If you switch from Mailgun's API integration to its SMTP relay (or vice versa), your existing DNS authentication records generally carry over unchanged — it is the sending method in your app that needs updating, not the domain verification you already completed.
If you run multiple sending domains through Mailgun, keep their individual authentication records organized in one reference document rather than relying on the dashboard alone.
Related reading: Cloudflare smtp relay · Gmail mail smtp · test your email deliverabilityA dedicated SMTP server, from $39.99/mo
Dedicated IP, unlimited sending, and automatic SPF/DKIM/DMARC - live in minutes, cancel anytime.
Frequently asked questions
What is the Mailgun SMTP relay?
A way to send through Mailgun using standard SMTP (host + port 587 + credentials) instead of its API - Mailgun handles authentication and delivery.
Does Mailgun give a dedicated IP?
Only on higher plans. For a dedicated IP with flat pricing at volume, compare a dedicated SMTP server.