Documentation
¶
Overview ¶
Package mailer defines the GoTrue mail abstraction. Delivery is wired through internal/mailer/templatemailer.FromConfig, which selects a mailer.Client by GOTRUE_MAILER_MAILER_PROVIDER—implementing the Phase 10.6 email provider surface (console, SMTP, Resend, SES) as Go packages, driven from supatype.config.ts `email`.
Index ¶
Constants ¶
View Source
const ( SignupVerification = "signup" RecoveryVerification = "recovery" InviteVerification = "invite" MagicLinkVerification = "magiclink" EmailChangeVerification = "email_change" EmailOTPVerification = "email" EmailChangeCurrentVerification = "email_change_current" EmailChangeNewVerification = "email_change_new" ReauthenticationVerification = "reauthentication" // Account Changes Notifications PasswordChangedNotification = "password_changed_notification" EmailChangedNotification = "email_changed_notification" PhoneChangedNotification = "phone_changed_notification" IdentityLinkedNotification = "identity_linked_notification" IdentityUnlinkedNotification = "identity_unlinked_notification" MFAFactorEnrolledNotification = "mfa_factor_enrolled_notification" MFAFactorUnenrolledNotification = "mfa_factor_unenrolled_notification" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
Mail(
ctx context.Context,
to string,
subject string,
body string,
headers map[string][]string,
typ string,
) error
}
TODO(cstockton): Mail(...) -> Mail(Email{...}) ?
type EmailData ¶
type EmailData struct {
Token string `json:"token"`
TokenHash string `json:"token_hash"`
RedirectTo string `json:"redirect_to"`
EmailActionType string `json:"email_action_type"`
SiteURL string `json:"site_url"`
TokenNew string `json:"token_new"`
TokenHashNew string `json:"token_hash_new"`
OldEmail string `json:"old_email"`
OldPhone string `json:"old_phone"`
Provider string `json:"provider"`
FactorType string `json:"factor_type"`
}
type Mailer ¶
type Mailer interface {
InviteMail(r *http.Request, user *models.User, otp, referrerURL string, externalURL *url.URL) error
ConfirmationMail(r *http.Request, user *models.User, otp, referrerURL string, externalURL *url.URL) error
RecoveryMail(r *http.Request, user *models.User, otp, referrerURL string, externalURL *url.URL) error
MagicLinkMail(r *http.Request, user *models.User, otp, referrerURL string, externalURL *url.URL) error
EmailChangeMail(r *http.Request, user *models.User, otpNew, otpCurrent, referrerURL string, externalURL *url.URL) error
ReauthenticateMail(r *http.Request, user *models.User, otp string) error
GetEmailActionLink(user *models.User, actionType, referrerURL string, externalURL *url.URL) (string, error)
// Account Changes Notifications
PasswordChangedNotificationMail(r *http.Request, user *models.User) error
EmailChangedNotificationMail(r *http.Request, user *models.User, oldEmail string) error
PhoneChangedNotificationMail(r *http.Request, user *models.User, oldPhone string) error
IdentityLinkedNotificationMail(r *http.Request, user *models.User, provider string) error
IdentityUnlinkedNotificationMail(r *http.Request, user *models.User, provider string) error
MFAFactorEnrolledNotificationMail(r *http.Request, user *models.User, factorType string) error
MFAFactorUnenrolledNotificationMail(r *http.Request, user *models.User, factorType string) error
}
Mailer defines the interface a mailer must implement.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package consoleclient implements mailer.Client by logging structured email metadata.
|
Package consoleclient implements mailer.Client by logging structured email metadata. |
|
Package mailmeclient provides an implementation of mailer.Client that uses gopkg.in/gomail.v2 to send via SMTP.
|
Package mailmeclient provides an implementation of mailer.Client that uses gopkg.in/gomail.v2 to send via SMTP. |
|
Package noopclient provides an implementation of mailer.Client that simply does nothing.
|
Package noopclient provides an implementation of mailer.Client that simply does nothing. |
|
Package resendclient implements mailer.Client using the Resend API.
|
Package resendclient implements mailer.Client using the Resend API. |
|
Package sesclient implements mailer.Client using AWS SES v2.
|
Package sesclient implements mailer.Client using AWS SES v2. |
|
Package taskclient provides an implementation of mailer.Client that uses the apitask package to send mail in the background.
|
Package taskclient provides an implementation of mailer.Client that uses the apitask package to send mail in the background. |
Click to show internal directories.
Click to hide internal directories.