Transactional email API for Go
Start sending emails from your Golang applications in minutes with a dependably fast transactional messaging platform.
Integrates easily with your Go app
package main
import (
"context"
"os"
"fmt"
"time"
"github.com/mailersend/mailersend-go"
)
func main() {
// Create an instance of the mailersend client
ms := mailersend.NewMailersend(os.Getenv("MAILERSEND_API_KEY"))
ctx := context.Background()
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
subject := "Subject"
text := "This is the text content"
html := "This is the HTML content
"
from := mailersend.From{
Name: "Your Name",
Email: "your@domain.com",
}
recipients := []mailersend.Recipient{
{
Name: "Your Client",
Email: "your@client.com",
},
}
// Send in 5 minute
sendAt := time.Now().Add(time.Minute * 5).Unix()
tags := []string{"foo", "bar"}
message := ms.Email.NewMessage()
message.SetFrom(from)
message.SetRecipients(recipients)
message.SetSubject(subject)
message.SetHTML(html)
message.SetText(text)
message.SetTags(tags)
message.SetSendAt(sendAt)
message.SetInReplyTo("client-id")
res, _ := ms.Email.Send(ctx, message)
fmt.Printf(res.Header.Get("X-Message-Id"))
}
Built around clean, logical endpoints
Send order confirmations, password resets, OTPs and more.
/bulk-email
Send service updates, event reminders, and account summaries.
/activity
Create custom dashboards or integrate activity metrics into other apps.
/analytics
Automate reports, pull data into internal tools, or trigger conditional logic.
/domains
Automate domain setup and get an overview of active domains.
/inbound
Manage inbound routes and create user-specific routes on signup.
/recipients
Share recipient data across tools to sync contacts and manage suppressions.
/templates
Send with email templates that look professional and contain dynamic content.
/email-verification
Configure forms to perform real-time email validation or verify a whole list.
/sms
Send appointment reminders, 2FA messages, shipping updates and more.
/smtp-users
Programmatically create SMTP users during environment setup.
View more endpoints
Your go-to email API toolkit
API reference
Your quick-check reference for all MailerSend API features and endpoints.
GitHub repository
The official MailerSend Go SDK with working code examples you can drop right into your apps.
Developer guide
Our technical guide to getting started with the MailerSend Golang SDK and sending your first email message.
Go help article
An in-depth article with clear examples for sending different emails with Go via API or SMTP.
Support for simple SMTP integrations
Reliable, secure SMTP server integration is available for compatibility with legacy systems or more basic configurations using native or community-based Go packages.
Optimized for deliverability at every layer
From infrastructure to sending practices, deliverability is built into every layer of our platform, ensuring fast, trusted inbox delivery for your Go app’s transactional emails.
Debug, track and monitor every send
-
End-to-end activity tracking
View real-time events from when an email is queued to the moment it’s clicked and everything in between. Plus, get the full bounce and deferred reasons. -
API & SMTP logs
Get full visibility into each request, including the response code, method, endpoint, IP address, user agent, and timestamp, in the API and SMTP logs. -
Instant webhook notifications
Push events directly to your system with webhooks, and set up alerts about bounces and spam complaints to optimize your workflows and catch issues fast. -
DMARC monitoring
Monitor your domain’s sending activity to address authentication issues, identify unauthorized senders, and protect your domain reputation.
Inbound email processing
Route incoming emails to your Go app or other integrated platforms. Improve customer support ticketing, add email-based functionality, and enable 2-way messaging.
Build, customize and personalize emails
Build dynamic templates with the HTML and drag and drop builders for personalized messaging at scale. Plus, use custom headers to customize tracking and unsubscribe headers, and pass other data.
One account to manage multiple senders
Use multiple domains and sender identities to manage the transactional email of all your clients or brands, while keeping settings and data separate.
User permissions you can tailor to each person
Assign admin, manager, designer or accountant rights, or handpick the settings, features and templates a user can access with a completely custom role.
Technical support you can rely on
Whether you need help troubleshooting or some friendly guidance about an advanced feature, our award-winning support team is just a click away.
Dev-approved, team-friendly
Get started for free
Try out MailerSend’s email API and Go SDK for free and send your first email in minutes with a trial domain. Subscribe to a Free plan for up to 500 emails/month or upgrade for as little as $7/month.
Pricing
Professional
For agencies and white-label resellers sending at scale
Starter
For growing startups and small businesses
Hobby
For personal projects and side hustles
Free
For occasional email testing and sending
Enterprise
For large organizations with special requirements
-
14-days API logs retention
-
Enterprise-grade support
-
Dedicated IP
Explore all features
Email API
Start sending and tracking your emails with our easy API integration process and clean documentation.
Multiple domains
Use multiple domains to manage different brands or products with one MailerSend account.
Suppression management
Protect your sending reputation by adding email addresses and domains that you should not send to.
Transactional SMS
Enhance the customer experience by sending high-volume, toll-free text messages using a unique and recognizable phone number.
Email verification
Verify a single email address or upload an entire email list to verify in bulk.
MCP server
Connect an AI tool to your MailerSend account for live data access that makes task automation faster and more reliable.
And much more to deliver, every single time
FAQs
How does the SDK handle API rate limiting and retries in a concurrent Go application?
API requests to the email endpoint are limited at 120 requests per minute. You can also use the bulk email endpoint to send multiple messages in a single request and optimize your email sendings.
How does the Go SDK handle dynamic data when using MailerSend's HTML templates?
Dynamic data for email templates is handled through template personalization variables that are passed when the email is sent. The variables are inserted into your stored template when the email is rendered. Learn more about how to use personalization.
Can I send bulk or batch emails using the SDK to improve API efficiency?
Yes, the bulk email endpoint can be used to send up to 500 emails in a single request, each with up to 50 recipients.
Does MailerSend support webhook validation within a Go application?
Webhook requests made by MailerSend include a Signature header, which you can validate in Go to verify the request. Check out our developer guide to learn more and get the sample code for verifying a signature.