Email For Developers
Mailgun is a set of powerful APIs that allow you to send, receive, track and store email effortlessly.Customers case studies
Features more features
Built For Developers
Control everything through intuitive, RESTful APIs.
- Fast and simple HTTP API or SMTP interface.
- Server-side MIME assembly. No libraries required.
- Live logs and webhook event notifications.
- Everything is built and priced to scale with you.
Let us worry about the headaches of managing an email server.
Optimized Deliverability
Get emails delivered to inbox.
- Processing of ESP feedback to optimize sending rates.
- Clean IP addresses and whitelist registrations.
- Proper authentication using SPF and DKIM.
- Automated bounce, unsubscribe and complaint handling.
We provide the best infrastructure and deliverability expertise.
Receiving, Parsing & Storage
Real email servers, not just SMTP relay.
- Create and manage mailboxes programmatically.
- White label domains and spam filtering.
- Routes to filter, parse and POST messages to your app.
- Attachments, signatures and replies parsing.
Email is not just sending, use Mailgun to engage your users.
Track Everything
Analytics to measure and improve your performance.
- Track clicks, opens, unsubscribes, bounces and complaints.
- Create multiple campaigns with simple tagging.
- Get notified of events in real time via HTTP.
- Use with Mailing Lists for scalable newsletters.
More than enough data to impress any VP of Marketing.
Developer Examples developer docs
- RestClient.post "https://api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0" \
- "@api.mailgun.net/v2/samples.mailgun.org/messages",
- :from => "Excited User <me@samples.mailgun.org>",
- :to => "dude@mailgun.net, devs@mailgun.net",
- :subject => "Hello",
- :text => "Testing some Mailgun awesomeness!"
- requests.post(("https://api.mailgun.net/v2/samples.mailgun.org/messages"),
- auth=("api", "key-3ax6xnjp29jd6fds4gc373sgvjxteol0"),
- data={
- "from": "Excited User <me@samples.mailgun.org>",
- "to": ["dude@mailgun.net",
- "devs@mailgun.net"],
- "subject": "Hello",
- "text": "Testing some Mailgun awesomeness!"})
- $request = new HttpRequest('https://api.mailgun.net/v2/samples.mailgun.org/messages', HttpRequest::METH_POST);
- $auth = base64_encode('api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0');
- $request->setHeaders(array('Authorization' => 'Basic '.$auth));
- $request->setPostFields(array('from' =>'Excited User <Excited User <me@samples.mailgun.org>',
- 'to' => 'dude@mailgun.net, devs@mailgun.net',
- 'subject' => 'Hello',
- 'text' => 'Testing some Mailgun awesomeness!'));
- $request->send();
- Client client = Client.create();
- client.addFilter(new HTTPBasicAuthFilter("api","key-3ax6xnjp29jd6fds4gc373sgvjxteol0"));
- WebResource webResource = client.resource("https://api.mailgun.net/v2/samples.mailgun.org/messages");
- MultivaluedMapImpl formData = new MultivaluedMapImpl();
- formData.add("from", "Excited User <me@samples.mailgun.org>");
- formData.add("to", "dude@mailgun.net");
- formData.add("to", "devs@mailgun.net");
- formData.add("subject", "Hello");
- formData.add("text", "Testing some Mailgun awesomeness!");
- webResource.type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, formData);
- RestClient client = new RestClient();
- client.BaseUrl = "https://api.mailgun.net/v2";
- client.Authenticator = new HttpBasicAuthenticator("api", "key-3ax6xnjp29jd6fds4gc373sgvjxteol0");
- RestRequest request = new RestRequest();
- request.AddParameter("domain", "samples.mailgun.org", ParameterType.UrlSegment);
- request.Resource = "{domain}/messages";
- request.AddParameter("from", "Excited User <me@samples.mailgun.org>");
- request.AddParameter("to", "dude@mailgun.net");
- request.AddParameter("to", "devs@mailgun.net");
- request.AddParameter("subject", "Hello");
- request.AddParameter("text", "Testing some Mailgun awesomeness!");
- request.Method = Method.POST;
- client.Execute(request);
- curl -s -k --user api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0 \
- https://api.mailgun.net/v2/samples.mailgun.org/messages \
- -F from='Excited User <me@samples.mailgun.org>' \
- -F to='Dude <dude@mailgun.net>'\
- -F to=devs@mailgun.net \
- -F subject='Hello' \
- -F text='Testing some Mailgun awesomeness!'