We will deprecate this version on February 10, 2025. To access all the latest features and upcoming developments, please see our v3 API. For assistance with transitioning, refer to our migration guide.
We recommend using SendGrid Go, our client library, available on GitHub, with full documentation.
The library does not officially support the V2 API, but you can use V2 with an older version of the library. For more information, see Continue Using V2 in Go.
1// using SendGrid's Go Library2// https://github.com/sendgrid/sendgrid-go3package main45import (6"github.com/sendgrid/sendgrid-go"7)89func main() {10sg := sendgrid.NewSendGridClientWithApiKey("SENDGRID_APIKEY")1112message := sendgrid.NewMail()13message.AddTo("test@sendgrid.com")14message.SetFrom("you@youremail.com")15message.SetSubject("Sending with SendGrid is Fun")16message.SetHTML("and easy to do anywhere, even with Go")1718sg.Send(message)19}