Documentation
¶
Overview ¶
Package mail defines how the auth module sends email.
A project passes a Mailer in auth.Config: usually the Resend adapter in mail/resend, a Writer during local development, or mailtest.Recorder in tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mailer ¶
Mailer sends one email. The auth module calls Send from a background goroutine and retries on error, so an implementation should return an error for any failure worth retrying.
type Message ¶
type Message struct {
To string
Subject string
// Text is the plain-text body. It's always set.
Text string
// HTML is an optional HTML body.
HTML string
// IdempotencyKey is the same on every retry of one message, so a
// provider that supports it can drop duplicates.
IdempotencyKey string
}
Message is one email.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer is a Mailer for local development that prints each email to an io.Writer instead of sending it.
Emails contain working links with live tokens, so a Writer must never be used in production: anyone who can read its output can take over accounts. auth.New logs a warning when it's given one.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mailtest provides a fake Mailer for tests.
|
Package mailtest provides a fake Mailer for tests. |
|
Package resend sends the auth module's email through Resend (https://resend.com), the standard transactional email provider.
|
Package resend sends the auth module's email through Resend (https://resend.com), the standard transactional email provider. |