Last active
May 11, 2016 17:46
-
-
Save sendgrid-gists/64953cac32d2af325281dcee8b03d787 to your computer and use it in GitHub Desktop.
"Hello World" for email, using SendGrid with Go.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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