Skip to content

Instantly share code, notes, and snippets.

@sendgrid-gists
Last active May 11, 2016 17:46
Show Gist options
  • Save sendgrid-gists/64953cac32d2af325281dcee8b03d787 to your computer and use it in GitHub Desktop.
Save sendgrid-gists/64953cac32d2af325281dcee8b03d787 to your computer and use it in GitHub Desktop.
"Hello World" for email, using SendGrid with Go.
// using SendGrid's Go Library
// https://github.com/sendgrid/sendgrid-go
package main
import (
"github.com/sendgrid/sendgrid-go"
)
func main() {
sg := sendgrid.NewSendGridClientWithApiKey("SENDGRID_APIKEY")
message := sendgrid.NewMail()
message.AddTo("test@sendgrid.com")
message.SetFrom("you@youremail.com")
message.SetSubject("Sending with SendGrid is Fun")
message.SetHTML("and easy to do anywhere, even with Go")
sg.Send(message)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment