We recommend using SendGrid Go, our client library, available on GitHub, with full documentation.
Do you have an API Key yet? If not, go get one. You're going to need it to integrate!
_30// using SendGrid's Go Library_30// https://github.com/sendgrid/sendgrid-go_30package main_30_30import (_30 "fmt"_30 "log"_30 "os"_30_30 "github.com/sendgrid/sendgrid-go"_30 "github.com/sendgrid/sendgrid-go/helpers/mail"_30)_30_30func main() {_30 from := mail.NewEmail("Example User", "test@example.com")_30 subject := "Sending with SendGrid is Fun"_30 to := mail.NewEmail("Example User", "test@example.com")_30 plainTextContent := "and easy to do anywhere, even with Go"_30 htmlContent := "<strong>and easy to do anywhere, even with Go</strong>"_30 message := mail.NewSingleEmail(from, subject, to, plainTextContent, htmlContent)_30 client := sendgrid.NewSendClient(os.Getenv("SENDGRID_API_KEY"))_30 response, err := client.Send(message)_30 if err != nil {_30 log.Println(err)_30 } else {_30 fmt.Println(response.StatusCode)_30 fmt.Println(response.Body)_30 fmt.Println(response.Headers)_30 }_30}