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.

Using SendGrid’s Go Library

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// 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)
}