Limited-time offer The first 2,000 users get 10,000 emails/month free for a year 1,995 of 2,000 spots left Claim yours

Guides

Use Mailgun SMTP for your website contact form

Mailgun’s SMTP relay sends from your own domain with per-domain credentials. Pick the host for your account’s region and you’re set.

Last updated October 26, 2026

1Add and verify a sending domain

In Mailgun, add a sending domain (a subdomain like mg.yourdomain.com is common) and create the DNS records it lists. Note whether the domain is in the US or EU region.

2Create SMTP credentials

Go to Sending → Domain settings, choose your domain, then the SMTP credentials tab. Create a login such as postmaster@mg.yourdomain.com and set its password. Credentials are separate for each domain.

3Enter the settings in FormSMTP

Sign up free, add a project and pick Mailgun as the provider so the host and port fill in.

ProviderMailgun
Hostsmtp.mailgun.org (US) or smtp.eu.mailgun.org (EU)
Port587 with SSL off (STARTTLS), or 465 with SSL on. 2525 also works.
UsernameThe full SMTP login, e.g. postmaster@mg.yourdomain.com
PasswordThe password you set for that login
From emailAn address on your sending domain

FormSMTP fills in the US host; switch to the EU host if your domain is in the EU region.

Click Test connection, then add your form. See the HTML contact form guide, or compare every provider on the SMTP settings page.

Common errors

  • 535 Authentication failed: the wrong region host (a US login won’t work on the EU host, and vice versa), or credentials from a different domain.
  • Sandbox domain errors: Mailgun’s sandbox domain only delivers to authorized recipients you add in Mailgun. Use your own verified domain for a live form.
  • Connection timeouts: try port 2525 or 465.

FAQ

US or EU host?

Use the region your domain was created in: smtp.mailgun.org for US, smtp.eu.mailgun.org for EU. The domain list in Mailgun shows the region.

Can I use my Mailgun account login?

No. SMTP uses per-domain credentials created under Domain settings → SMTP credentials.

Why do my messages land in spam?

Usually the From address isn’t on a domain you’ve verified with the provider, or the domain has no SPF and DKIM records. Verify the domain, send from an address on it, and check the Deliverability panel in FormSMTP’s Settings.

More guides

Get a Founding Pass

10,000 emails a month, free for your first year. Pass No. 0006 is next: 1,995 of 2,000 left, no card.