Documentation
¶
Overview ¶
Package onboardmail sends the welcome email and the setup reminders: at most three emails per user ever (one welcome, two reminders), only to a verified address, only until the truck is connected and sending data, and never after the user opted out. Every email carries a signed one-click unsubscribe link and List-Unsubscribe headers. No tracking pixel, no rewritten links.
Index ¶
Constants ¶
const ( NudgeMinAge = 72 * time.Hour NudgeFollowUp = 6 * 24 * time.Hour )
Timing of the setup reminders: the first once the account is three days old, the follow-up six days after the first.
const UnsubPurpose = "onboarding"
UnsubPurpose is the token "period" that scopes a signed link to these emails: the statement email's unsubscribe only accepts YYYY-MM.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Content ¶
type Content struct {
Subject, Text string
Key string // idempotency key prefix (Resend dedupes for 24 h)
Attempt int
UnsubscribeURL string
}
Content is one email to send.
type Job ¶
type Job struct {
DB *sql.DB
Mail Sender
// Signer returns the unsubscribe-link signer, or nil: then nothing is
// sent (no way to unsubscribe). A func because the signer is built after
// the sweep is wired.
Signer func() *statement.Signer
BaseURL string
Logger *slog.Logger
Now func() time.Time
// OnSent, when set, is told after each send (metrics, funnel log).
OnSent func(kind string, attempt int, uid uuid.UUID)
}
Job sweeps for users due a welcome or a reminder and sends it.