Documentation
¶
Overview ¶
Package mail is how the session library sends mail: the invitation a tenant's administrator sends to an address, the link that verifies an address a person adds or changes, and the link a password sign-up starts from. The library writes to the Sender interface and knows nothing of the mail system behind it; an application configures a driver, the Google Workspace SMTP relay in mail/workspace, and hands it to the Auth. Every message is plain text with one link in it, from the one address the driver is configured to send as.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Log ¶
type Log struct{}
Log is a Sender for development: it writes each message to the request's logger, link included, and sends nothing, so a developer follows the link from the log. Never for a deployed environment, where the links are secrets: there the application configures a driver.
type Message ¶
type Message struct {
// To is the recipient's address, one address with or without a display name
// ("Ada Lovelace <ada@example.com>").
To string
// Subject is the subject line, in any language; the driver encodes it.
Subject string
// Text is the plain-text body, in any language.
Text string
}
Message is one message to send: the recipient, the subject and the plain-text body. The sender's address and display name are the driver's settings, not the message's, so every message an application sends comes from the one address it is configured with.
type Recorder ¶
type Recorder struct {
// Sent holds the messages sent so far, in order.
Sent []Message
// Err, when set, is what Send answers after recording the message.
Err error
// contains filtered or unexported fields
}
Recorder is a Sender for tests: it keeps every message it was asked to send, in order, and answers Err when one is set. It is safe for concurrent use.
func (*Recorder) Fail ¶ added in v0.3.0
Fail sets what Send answers from now on, nil for a sender that works again: a test that fails the sender part of the way through sets it here, under the recorder's lock.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package workspace sends the session library's mail through the Google Workspace SMTP relay: a plain mail submission to smtp-relay.gmail.com on port 587 over TLS, which Google Cloud's compute products allow (they block port 25, the port a mail server of our own would need), authenticated as one mailbox of the organization's Workspace domain with an app password.
|
Package workspace sends the session library's mail through the Google Workspace SMTP relay: a plain mail submission to smtp-relay.gmail.com on port 587 over TLS, which Google Cloud's compute products allow (they block port 25, the port a mail server of our own would need), authenticated as one mailbox of the organization's Workspace domain with an app password. |