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!
1// using SendGrid's Go Library2// https://github.com/sendgrid/sendgrid-go3package main45import (6"fmt"7"log"8"os"910"github.com/sendgrid/sendgrid-go"11"github.com/sendgrid/sendgrid-go/helpers/mail"12)1314func main() {15from := mail.NewEmail("Example User", "test@example.com")16subject := "Sending with SendGrid is Fun"17to := mail.NewEmail("Example User", "test@example.com")18plainTextContent := "and easy to do anywhere, even with Go"19htmlContent := "<strong>and easy to do anywhere, even with Go</strong>"20message := mail.NewSingleEmail(from, subject, to, plainTextContent, htmlContent)21client := sendgrid.NewSendClient(os.Getenv("SENDGRID_API_KEY"))22response, err := client.Send(message)23if err != nil {24log.Println(err)25} else {26fmt.Println(response.StatusCode)27fmt.Println(response.Body)28fmt.Println(response.Headers)29}30}