Documentation
¶
Overview ¶
Package sendgrid is a minimal client for the SendGrid v3 Email Address Validation API.
Index ¶
Constants ¶
const ( VerdictValid = "Valid" VerdictRisky = "Risky" VerdictInvalid = "Invalid" )
Verdicts returned by the Email Address Validation API.
const DefaultBaseURL = "https://api.sendgrid.com"
DefaultBaseURL is the global SendGrid API host. Accounts with EU data residency use https://api.eu.sendgrid.com.
const DefaultTimeout = 3 * time.Second
DefaultTimeout bounds each request. Cognito waits at most 5 seconds for a trigger, so a slow validation must not use up that time.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client calls the SendGrid API with one API key.
func New ¶
New returns a client for baseURL (DefaultBaseURL when empty). A nil httpClient uses a client with DefaultTimeout.
func (*Client) ValidateEmail ¶
ValidateEmail validates one address. It returns the parsed result and the raw response body.
type Validation ¶
type Validation struct {
Email string `json:"email"`
Verdict string `json:"verdict"`
Score float64 `json:"score"`
Checks struct {
Domain struct {
HasValidAddressSyntax bool `json:"has_valid_address_syntax"`
HasMXOrARecord bool `json:"has_mx_or_a_record"`
IsSuspectedDisposableAddress bool `json:"is_suspected_disposable_address"`
} `json:"domain"`
LocalPart struct {
IsSuspectedRoleAddress bool `json:"is_suspected_role_address"`
} `json:"local_part"`
Additional struct {
HasKnownBounces bool `json:"has_known_bounces"`
HasSuspectedBounces bool `json:"has_suspected_bounces"`
} `json:"additional"`
} `json:"checks"`
}
Validation is the result of validating one email address.