Fast, easy SMTP API for your emails

Integrate with Mailgun’s SMTP API and start sending emails today. Whether you want to send 10 emails or 10 million, SMTP APIs offer a potent and flexible solution that scales.

Custom email handling with SMTP API

Simple mail transfer protocol (SMTP) is a fast, easy way to send email messages from one mail server to another.

When you use a personal email address to send bulk marketing campaigns or transactional emails to a lengthy contact list, you can bump up against send rate limits, get flagged as spam, or have to awkwardly blind carbon copy your mailing list on every email message.

In that case, SMTP relay, in which a third party sends email to multiple recipients over its own mail servers, may make sense. The sender address is the same and the email content is absolutely secure, but by sending the marketing or transactional email through a partner’s server, you can increase your email delivery rate without the hassle, costs, or security concerns associated with maintaining your own mail server. It’s a lot better than trying to push everything through a consumer email address, such as Google’s gmail.

Cloud-based SMTP relay isn’t the only option for sending email to multiple recipients without getting an error message or having to read the fine print of your account details. You can also use an SMTP API. Anyone with an API overview under their belt knows that APIs – which allow two applications to talk to each other – can be both powerful and customizable.

A graphic illustration of mobile email templates.

SMTP relay server in action

Mailgun doesn’t force users to integrate APIs, but we do think our HTTP API offers more flexibility and better scalability for batch sending than simple SMTP relay service. The Mailgun API is built on HTTP, which means it:

  • Uses built-in HTTP capabilities for passing parameters and authentication

  • Responds with standard HTTP response codes to indicate errors

  • Uses predictable, resource-oriented URLs

  • Returns JSON string

Developers that opt for Mailgun’s API won’t have to deal with MIME, because that’s handled internally. Developers can simply use a request library in the programming language of their choice (whether that’s Ruby, Python, Java or something else).

Three email icons lined up diagonally.

SMTP APIs in action

If you’re ready to send emails to multiple recipients, setting up Mailgun’s email API is extremely simple. You can quickly grab the API key from within the control panel and get started. The SMTP API can integrate with both internal and third-party systems.

Automated transactional emails sent using the SMTP API are triggered by certain customer behaviors such as making a purchase or requesting a password reset. Your app will pass a message over to the Mailgun mail server. From there, Mailgun will not only send email to the recipient’s mailbox but report all event data associated with that specific email. That means Mailgun can automatically help track and analyze everything from click tracking to A/B testing.

Sign up today

Start sending with SMTP API

Integrate with our SMTP API in minutes. It’s free to sign up! See what you can accomplish with the world's best email delivery platform.

Check out our plans to bundle together features for better deliverability. For businesses that send over 100,000 emails.

Other features

Explore beyond SMTP

Mailgun has a variety of features for companies searching for an SMTP API solution.

Window icon

Products

Trophy icon

Solutions

Open email icon

Use Cases

See what you can accomplish with the world's best email delivery platform

It's easy to get started. And it's free.
CTA icon