julianvilas / gmailer

Simple Go library to send emails using AWS SES

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gmailer

Build Status

Simple Go library to send emails using AWS SES. In order to send the email you need to setup your AWS credentials as specified in the aws-sdk-go documentation.

It has a function to send simple emails SendEmail and a function to send raw emails SendRaw. The latest is useful for sending emails with attachments.

Examples

Assuming you have credentials configured in your default shared credentials profile (~/.aws/credentials):

func main() {
	sess := session.Must(session.NewSession(&aws.Config{
		Region: aws.String("eu-west-1"),
	}))
	svc := ses.New(sess)

	m := gmailer.New(svc)
	err := m.SendRaw(gmailer.Email{
		Subject:     "A fancy email sent with AWS SES",
		Body:        "Here I'll tell you lovely things.",
		From:        "alice@example.com",
		Dest:        []string{"bob@example.com"},
	})
	if err != nil {
		log.Panicf("executing sending email:", err)
	}
}

About

Simple Go library to send emails using AWS SES


Languages

Language:Go 100.0%