Which Method Works Best for You?
To get your sending off the ground, after you've got your domain added and fully configured, you need to decide which of our two methods you're going to use; SMTP or API. You'll be using one of the two methods to send via our platform using a sending application of your choice.
Both methods work very well - it's all about what your use case needs happen to be, as well as your personal preferences. At a glance:
- Flexible with existing applications
- Less technical/coding knowledge not necessary
- Open protocol
- Faster (three times faster!)
- More technical/coding knowledge necessary;
- No need to craft a MIME (message body) - we assemble it on our side!
- Better for large scale sending; more volume, to more recipients, with less effort
How Do We Put This Into Practice?
Here's a snapshot of sending via Mailgun with our API:
- Have your API key ready, found in your Mailgun control panel. Need help? Look here.
- Your API base url will be
- US region: https://api.mailgun.net/v3/YOUR_DOMAIN/
- EU region: https://api.eu.mailgun.net/v3/YOUR_DOMAIN/
- Check out our libraries for easy integration with Python, Ruby, Java, C# and PHP
Here's sample code for sending an email with cURL:
curl -s --user 'api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0' \ https://api.mailgun.net/v3/samples.mailgun.org/messages \ -F from='Excited User <firstname.lastname@example.org>' \ -F email@example.com' \
-F subject='Hello' \ -F text='Testing some Mailgun awesomeness!'
This is of course a quick summary view of the process start to sending; for more information, check out our quickstart guide to help get you sending right away!
If any questions arise, just reach out to our Support team via the Support tab in your Mailgun control panel.