- What's new
Easier and Faster Implementation with Our Updated SDKs
Today, we’re happy to announce the general availability of our Mailgun-Go SDK. Now you can send messages through Mailgun using Go! Mailgun-Go allows you to easily interact with our API by greatly reducing the amount of boiler-plate code you need to maintain.
Our SDK is built from a simple foundation graciously offered by Michael Banzon on Github. We are truly indebted to him for his support. We added features on top of his own SDK, including significantly enhanced API coverage, and a rich set of acceptance tests to help developers get started and better understand how to use the SDK.
Mailgun-Go lets you send messages to mailing lists of arbitrary size, subject only to the limitations of your Mailgun account. Here’s a simple example where we send one message to three recipients:
1mg := mailgun.NewMailgun("example.com", "key-example", "")23m := mg.NewMessage( 4 "Dwight Schrute <dwight@example.com>", // From5 "The Printer Caught Fire", // Subject6 "We have a problem.", // Plain-text body7 "Michael Scott <michael@example.com>", // Recipients (vararg list)8 "George Schrute <george@example.com>",9 "it-support@example.com",10)1112_, _, err := mg.Send(m)1314if err != nil { 15 log.Fatal(err)16}
and here’s one where we send the same message to potentially millions of recipients:
1mg := mailgun.NewMailgun("example.com", "key-example", "")23m := mg.NewMessage( 4 "Dwight Schrute <dwight@example.com>", // From5 "Help!", // Subject6 "The printer's on fire on floor %recipient.floor%!!" // Plain-text body7)89// Iterate over a collection of addresses and per-user variables.10for _, user := range mailingList { 11 err := m.AddRecipientAndVariables(user.address, map[string]interface{}{12 "floor": user.floor,13 })14 if err != nil {15 log.Fatal(err)16 }17}1819_, _, err = mg.Send(m)2021if err != nil { 22 log.Fatal(err)23}
As you can see, the Mailgun-Go SDK provides an interface that scales pleasantly with your needs.
We will be updating our online documentation to include Go examples soon. In the meantime, please feel free to consult our documentation on GoDoc, read the acceptance tests in our Github repository, or open a new issue through Github or your control panel. We’ll be happy to answer any questions you have!
Happy Sending!
It's easy to get started. And it's free.
See what you can accomplish with the world’s best email delivery platform.
Last updated on August 28, 2020
Easier and Faster Implementation with Our Updated SDKs
The Difference Between SMTP and API
The Basics of Email Dark Mode
COVID-19 Survey: How the Pandemic Has Affected Email Sending
The Top Email Clients and Email Apps of 2021
The Benefits of Email Automation
How To Avoid Emails Going To Spam
Which SMTP Port Should I Use? Understanding Ports 25, 465, & 587
When Should You Use An Email API?
Golang’s Superior Cache Solution to Memcached and Redis
Easier and Faster Implementation with Our Updated SDKs
We stand with the AAPI community
The Difference Between SMTP and API
The Basics of Email Dark Mode
COVID-19 Survey: How the Pandemic Has Affected Email Sending
Mailgun Validations Features Improved Performance for EU Customers
International Women’s Day: How Pathwire’s Female Leaders Choose To Challenge
The Top Email Clients and Email Apps of 2021
How To Build An Email List The Right Way
The Path To Email Engagement In 2021: Key Learnings
Easier and Faster Implementation with Our Updated SDKs
We stand with the AAPI community
The Difference Between SMTP and API
Preparing Your Email Infrastructure Correctly
4 Tips To Improve Your Email Deliverability In 2021
COVID-19 Email Communications Dos and Don’ts
How To Use Parallel Programming
Mailgun’s COVID-19 Plan of Action
Password Meters Are Not For Humans
Send Your Emails at the Perfect Time with Send Time Optimization
Always be in the know and grab free email resources!
By sending this form, I agree that Mailgun may contact me and process my data in accordance with its Privacy Policy.