We recommend using SendGrid Go, our client library, available on Github, with full documentation.

Using SendGrid’s Go Library

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// using SendGrid's Go Library - https://github.com/sendgrid/sendgrid-go
package main

import ("github.com/sendgrid/sendgrid-go")

func main() {
    sendgrid := sendgrid.NewSendGridClient(api_user, api_key)

    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")

    sendgrid.Send(message)
}