Provider setup

Mailgun SMTP test — domain credentials, ports, and common errors

Test Mailgun SMTP at smtp.mailgun.org on port 587 with STARTTLS. Use per-domain SMTP credentials (not your API key) and verify sender authentication.

4 min read Credentials redacted No signup

Connection settings

Host
smtp.mailgun.org
Port
587
Security
STARTTLS

Mailgun provides SMTP relay at smtp.mailgun.org (US region) or smtp.eu.mailgun.org (EU region) on port 587 with STARTTLS. The most common mistake is using the Mailgun private API key as the SMTP password — Mailgun separates REST API credentials from per-domain SMTP credentials.

Recommended settings

Finding your SMTP credentials

Mailgun issues SMTP credentials per sending domain, separate from the account-level API key:

  1. Log in to the Mailgun control panel.
  2. Navigate to Sending → Domain settings → select your domain.
  3. Go to the "SMTP credentials" tab.
  4. You will see the default [email protected] user (or another you created).
  5. Click "Reset password" to get a new SMTP password — copy it immediately, it is shown only once.

The username is the full SMTP user address (e.g. [email protected]). The password is the SMTP-specific password — not your Mailgun account password and not the private API key from the API Keys page.

Testing with SMTP Tester

  1. Host: smtp.mailgun.org (or smtp.eu.mailgun.org for EU domains).
  2. Port 587, security STARTTLS.
  3. Username: your SMTP user (e.g. [email protected]).
  4. Password: the SMTP password you copied from the control panel.
  5. From: an address on the verified domain (e.g. [email protected]).
  6. To: any recipient (sandbox domains restrict recipients — see below).
  7. Click Run. A 235 Accepted confirms authentication.

A 250 Great success after DATA means Mailgun accepted the message.

Common errors

535 "Authentication failed" / "Invalid login"

The most frequent Mailgun SMTP error on forums. Causes:

550 "Sandbox subdomains are for test purposes only"

If you are using Mailgun's default sandbox domain (e.g. sandboxXXXX.mailgun.org), you can only send to verified recipients listed in the control panel under "Authorized Recipients." Add the To address there or switch to a custom verified domain.

550 "Domain not found" / "Sender not authorized"

The From address is on a domain not verified in your Mailgun account. Verify the domain by adding the required DNS records (SPF, DKIM, MX) in the Mailgun Sending → Domain settings page.

Connection timeout

US vs EU regions

Mailgun separates infrastructure by region for data residency compliance:

Region SMTP host API base URL
US smtp.mailgun.org api.mailgun.net
EU smtp.eu.mailgun.org api.eu.mailgun.net

Domains created in one region cannot authenticate against the other. Check your domain's region in the Mailgun dashboard (Sending → Domain settings → the region badge).

Domain verification

Before Mailgun relays mail for a domain, you must verify ownership by adding DNS records:

Until DNS verification completes, sends may fail or be queued. The Mailgun dashboard shows a green checkmark once each record is detected.

Mailgun sending limits

Limits depend on your plan:

If you hit a rate limit, Mailgun returns 452 Too many recipients or queues the message silently. Check Logs in the dashboard for delivery status.

Multiple SMTP users

You can create additional SMTP users for a domain beyond the default postmaster@:

  1. Go to Sending → Domain settings → SMTP credentials.
  2. Click "New SMTP User."
  3. Choose a local part and set a password.

Each user can have its own password, allowing you to give different applications different credentials and revoke them independently.

Security notes

Try it on your own server

Run these settings against your SMTP server and watch the live, credential-redacted protocol transcript.

Open SMTP Tester