Documentation
¶
Overview ¶
Package smtpmail sends the mails of the API, such as login links, through an authenticated SMTP server reached over implicit TLS (RFC 8314).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrConfig = errors.New("smtp: incomplete configuration")
ErrConfig means a Config misses a value.
Functions ¶
This section is empty.
Types ¶
type AuthCheck ¶ added in v0.60.1
type AuthCheck struct {
// contains filtered or unexported fields
}
AuthCheck checks that a new key of the mail application authenticates with the SMTP server before it is put in service (#295). It implements app.CredentialInstaller, sends no mail and changes nothing.
func NewAuthCheck ¶ added in v0.60.1
func NewAuthCheck(opts AuthCheckOptions) (*AuthCheck, error)
NewAuthCheck returns an AuthCheck of opts, or ErrConfig.
func (*AuthCheck) InstallCredential ¶ added in v0.60.1
InstallCredential authenticates with the secret key of c, until it succeeds or the attempts are over. Its errors name the access key of c, never its secret key.
type AuthCheckOptions ¶ added in v0.60.1
type AuthCheckOptions struct {
// Addr is the host and port of the server, which speaks TLS at once,
// such as "smtp.tem.scw.cloud:465"; Username is the user a key
// authenticates as, its secret key being the password.
Addr, Username string
// HelloName is the domain sent with EHLO, such as "arnakoff.com".
HelloName string
// RootCAs are the authorities the server's certificate must chain to;
// nil means those of the system.
RootCAs *x509.CertPool
// Attempts is the number of authentications tried, 6 when zero; Pause
// the wait between two of them, a minute when zero.
Attempts int
Pause time.Duration
// Sleep waits d, or returns the error of ctx once it is done; the
// system clock when nil.
Sleep func(ctx context.Context, d time.Duration) error
}
AuthCheckOptions configures an AuthCheck.
type Config ¶
type Config struct {
// Addr is the host and port of the server, which speaks TLS at once,
// such as "smtp.tem.scw.cloud:465".
Addr string
// Username and Password authenticate with AUTH PLAIN, sent over TLS
// only.
Username string
Password []byte
// From is the sender address.
From domain.Email
// RootCAs are the authorities the server's certificate must chain to;
// nil means those of the system.
RootCAs *x509.CertPool
// Now dates the mails; nil means time.Now.
Now func() time.Time
// Random draws the message identifiers; nil means crypto/rand.Reader.
Random io.Reader
}
Config configures a Sender.