Documentation
¶
Overview ¶
Package mail delivers moth's transactional emails. Two transports: SMTP for production and a console logger so the whole auth flow works in dev with zero setup.
Index ¶
- type Brand
- type Console
- type Content
- type Dynamic
- type Mailer
- type Message
- func AccountExists(brand Brand, to string) Message
- func AdminInvite(to, link string) Message
- func EmailChangeConfirm(brand Brand, to, link string) Message
- func EmailChangedNotice(brand Brand, to, newEmail, revertLink string) Message
- func PasswordReset(brand Brand, to, link string) Message
- func RenderContent(brand Brand, to string, c Content) Message
- func Test(to string) Message
- func UserInvite(brand Brand, to, link string) Message
- func Verification(brand Brand, to, link string) Message
- type SMTP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Brand ¶
type Brand struct {
// Name of the project (or "moth" for instance-level mail).
Name string
// LogoURL is the absolute URL of the project's light-scheme logo;
// empty renders no logo. Email clients overwhelmingly render on white,
// so the light variant is the right one.
LogoURL string
// Accent is the button background (#RRGGBB); theme primary color.
Accent string
// OnAccent is the button text color (#RRGGBB); theme onPrimary.
OnAccent string
}
Brand is the sender identity an email renders with: the project name plus the optional design-system accents (plan/06). The zero-value accents fall back to moth's neutral defaults, so a Brand{Name: ...} alone always produces a decent email.
type Content ¶
Content is a pre-localized transactional email: the subject, body paragraphs and an optional action button, already resolved from the i18n catalog for the recipient's negotiated locale by the caller. It lets the auth handlers ship localized copy through the same branded layout the English helpers above use.
type Dynamic ¶
type Dynamic struct {
// contains filtered or unexported fields
}
Dynamic is a Mailer whose underlying transport can be swapped at runtime, so the admin console can reconfigure SMTP without a restart.
type Message ¶
Message is one email ready to send.
func AccountExists ¶
AccountExists is sent instead of an error when an enumeration-safe project sees a signup with an already-registered email.
func AdminInvite ¶
AdminInvite is the operator-invitation email for the moth admin console.
func EmailChangeConfirm ¶
EmailChangeConfirm goes to the NEW address to prove ownership before the account email switches.
func EmailChangedNotice ¶
EmailChangedNotice goes to the OLD address after the switch, carrying a revert link.
func PasswordReset ¶
PasswordReset is the "reset your password" email.
func RenderContent ¶
RenderContent builds a branded email from pre-resolved localized content.
func UserInvite ¶
UserInvite is the "set your password" email for an account created by an operator in the admin console.
func Verification ¶
Verification is the "confirm your email address" email.