FRGet In Touch
← Tech stack

Mailgun

An email delivery service for applications: password resets, notifications and reports, sent through an API and delivered to the inbox, not the spam folder.

Type
Transactional email API
Created by
Mailgun, part of Sinch
Sends through
An HTTP API or SMTP, with EU or US hosting
In my stack
App emails, or SendGrid, Resend and Postmark when they fit better

What it is

Sending one email is easy. Getting thousands of them delivered reliably is not: mailbox providers like Gmail and Outlook judge every sender, and mail from an unknown server often lands in spam or disappears. Mailgun handles that part. The app makes an API call, and Mailgun sends the message from well-reputed servers, retries when needed, and reports what happened.

It tracks every message: delivered, opened, clicked, bounced or marked as spam, with webhooks to tell the app. It manages suppression lists so you don’t keep emailing addresses that bounce, and helps set up SPF, DKIM and DMARC, the DNS records that prove an email really comes from your domain. SendGrid, Resend and Postmark offer the same core service with different strengths.

Why I use it

Emails arrive. A password reset or a notification that lands in spam is worse than useless: users think the app is broken.

Every message is traceable. When someone says “I never got the email”, the logs show whether it was delivered, bounced or blocked.

A sending domain you control. With SPF, DKIM and DMARC in place, the company’s domain is protected against spoofing.

EU hosting. Mailgun can process mail in the EU, which helps with data protection requirements.

Where I use it

The apps I build send email for password resets, invitations, notifications such as an action assigned or overdue, and scheduled reports. The backend calls the email service’s API rather than running its own mail server, and delivery events come back through webhooks. I usually use Mailgun, and choose SendGrid, Resend or Postmark when the client already has an account or one of them fits the project better.

Best use cases

  • Account emails: sign-up confirmation, password reset, invitations.
  • Workflow notifications: tasks assigned, approvals needed, deadlines approaching.
  • Scheduled reports and digests sent to managers.
  • Receiving email: Mailgun can also parse incoming messages and forward them to the app.

When I’d use something else

For newsletters and marketing campaigns, a dedicated tool like Brevo or Mailchimp, with templates, audiences and unsubscribe management, is a better fit than an API built for transactional email. For an urgent alert on a phone, a push notification through Firebase is often seen faster than an email.

A small example

Sending an email through Mailgun’s EU API with a single HTTP call. Any backend language can do the same.

curl -s --user "api:$MAILGUN_API_KEY" \
  https://api.eu.mailgun.net/v3/mg.example.com/messages \
  -F from="Example App <no-reply@mg.example.com>" \
  -F to="nora@example.com" \
  -F subject="An action was assigned to you" \
  -F text="A new corrective action is waiting for you. It is due on Friday."

Before the first email goes out, the domain needs its SPF and DKIM records, and ideally a DMARC policy, added in DNS, for example on Cloudflare. Without them, even a good service can’t keep messages out of spam.

Often used with

Need your app’s emails to reliably reach the inbox?

Get in touch and tell me about your project.