Mandrill
Simple package for sending emails through the Mandrill API.
Install / Use
/learn @keighl/MandrillREADME
Mandrill Emails via Golang
Stripped down package for sending emails through the Mandrill API. Inspired by @mostafah's implementation.
Installation
go get -u github.com/keighl/mandrill
Upgrading to 1.0
MessagesSend() and MessagesSendTemplate() now only returns 1 error interface (as opposed to a non-sensical 2).
// New!
res, err := client.MessagesSend(m)
// Old!
res, apiError, err := client.MessagesSend(m)
Documentation
http://godoc.org/github.com/keighl/mandrill
Regular Message
https://mandrillapp.com/api/docs/messages.JSON.html#method=send
import (
m "github.com/keighl/mandrill"
)
client := m.ClientWithKey("XXXXXXXXX")
message := &m.Message{}
message.AddRecipient("bob@example.com", "Bob Johnson", "to")
message.FromEmail = "kyle@example.com"
message.FromName = "Kyle Truscott"
message.Subject = "You won the prize!"
message.HTML = "<h1>You won!!</h1>"
message.Text = "You won!!"
responses, err := client.MessagesSend(message)
Send Template
https://mandrillapp.com/api/docs/messages.JSON.html#method=send-template
http://help.mandrill.com/entries/21694286-How-do-I-add-dynamic-content-using-editable-regions-in-my-template-
templateContent := map[string]string{"header": "Bob! You won the prize!"}
responses, err := client.MessagesSendTemplate(message, "you-won", templateContent)
Including Merge Tags
http://help.mandrill.com/entries/21678522-How-do-I-use-merge-tags-to-add-dynamic-content-
// Global vars
message.GlobalMergeVars = m.MapToVars(map[string]interface{}{"name": "Bob"})
// Recipient vars
bobVars := m.MapToRecipientVars("bob@example.com", map[string]interface{}{"name": "Bob"})
jillVars := m.MapToRecipientVars("jill@example.com", map[string]interface{}{"name": "Jill"})
message.MergeVars = []*m.RcptMergeVars{bobVars, jillVars}
Integration Testing Keys
You can pass special API keys to the client to mock success/err responses from MessagesSend or MessagesSendTemplate.
// Sending messages will be successful, but without a real API request
c := ClientWithKey("SANDBOX_SUCCESS")
// Sending messages will error, but without a real API request
c := ClientWithKey("SANDBOX_ERROR")
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。

