Documentation
¶
Overview ¶
Package sendgrid implements mail.Mailer against SendGrid's v3 HTTP API (https://docs.sendgrid.com/api-reference/mail-send/mail-send).
Usage:
m := sendgrid.New(sendgrid.Config{
APIKey: os.Getenv("SENDGRID_API_KEY"),
From: "noreply@example.com",
})
err := m.Send(ctx, mail.NewMessage().
To("user@example.com").
Subject("Hi").
HTML("<b>hello</b>").
Build())
Index ¶
Constants ¶
View Source
const DefaultEndpoint = "https://api.sendgrid.com/v3/mail/send"
DefaultEndpoint is SendGrid's mail-send v3 endpoint.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
APIKey string
// From is the default From address used when Message.From is empty.
From string
// Endpoint allows overriding the API URL (default: DefaultEndpoint).
// Mostly useful for tests.
Endpoint string
// HTTPClient defaults to a 30s-timeout client.
HTTPClient *http.Client
}
Config holds the SendGrid credentials and defaults.
Click to show internal directories.
Click to hide internal directories.