Skip to content
Brian Lachniet edited this page Jul 3, 2014 · 1 revision

Table of Contents

Mandrill

Send an Email

package main

import (
	"github.com/mattbaird/gochimp"
)

func main() {
	// Create a Mandrill object to interact with the Mandrill API
	mandrill, err := gochimp.NewMandrill("MyMandrillApiKey")
	if err != nil {
		panic(err)
	}

	// Create a mail message.
	msg := gochimp.Message{
		To:        []gochimp.Recipient{gochimp.Recipient{Email: "[email protected]"}},
		Subject:   "Hello",
		Html:      "Hi Bob. It's me, <strong>Alice</strong>",
		FromEmail: "[email protected]",
	}

	// Send the mail message using the Mandrill object.
	_, err = mandrill.MessageSend(msg, false)
	if err != nil {
		panic(err)
	}
}
Clone this wiki locally