Documentation ¶
Index ¶
- Constants
- Variables
- type APIToken
- type DeliveryRequest
- type Emailer
- type EnvironmentConfig
- type NoopEmailer
- type OutboundEmailMessage
- func BuildGeneratedPasswordResetTokenEmail(recipient *types.User, passwordResetToken *types.PasswordResetToken, ...) (*OutboundEmailMessage, error)
- func BuildInviteMemberEmail(accountInvitation *types.AccountInvitation, envCfg *EnvironmentConfig) (*OutboundEmailMessage, error)
- func BuildPasswordChangedEmail(recipient *types.User, envCfg *EnvironmentConfig) (*OutboundEmailMessage, error)
- func BuildPasswordResetTokenRedeemedEmail(recipient *types.User, envCfg *EnvironmentConfig) (*OutboundEmailMessage, error)
- func BuildUsernameReminderEmail(recipient *types.User, envCfg *EnvironmentConfig) (*OutboundEmailMessage, error)
- func BuildVerifyEmailAddressEmail(recipient *types.User, emailVerificationToken string, ...) (*OutboundEmailMessage, error)
Constants ¶
const ( // SentEventType indicates an email was sent. SentEventType types.ServiceEventType = "email_sent" // TemplateTypeInvite is used to indicate the invite template. TemplateTypeInvite = "invite" // TemplateTypeUsernameReminder is used to indicate the username_reminder template. TemplateTypeUsernameReminder = "username_reminder" // TemplateTypePasswordResetTokenCreated is used to indicate the password_reset template. TemplateTypePasswordResetTokenCreated = "password_reset_token_created" // TemplateTypePasswordReset is used to indicate the password_reset template. TemplateTypePasswordReset = "password_reset" // TemplateTypePasswordResetTokenRedeemed is used to indicate the password_reset_token_redeemed template. TemplateTypePasswordResetTokenRedeemed = "password_reset_token_redeemed" // TemplateTypeVerifyEmailAddress is used to indicate the verify_email_address template. TemplateTypeVerifyEmailAddress = "verify_email_address" )
Variables ¶
var (
ErrMissingEnvCfg = errors.New("missing environment configuration")
)
var (
ErrUnverifiedEmailRecipient = errors.New("missing email address verification for user")
)
Functions ¶
This section is empty.
Types ¶
type DeliveryRequest ¶
type DeliveryRequest struct { TemplateParams map[string]any `json:"templateParams"` Invitation *types.AccountInvitation `json:"invitation,omitempty"` PasswordResetToken *types.PasswordResetToken `json:"passwordResetToken,omitempty"` UserID string `json:"forUserId"` EmailVerificationToken string `json:"emailVerificationToken,omitempty"` Template string `json:"template"` // contains filtered or unexported fields }
DeliveryRequest is the type to use when requesting emails within the service.
type Emailer ¶
type Emailer interface {
SendEmail(ctx context.Context, details *OutboundEmailMessage) error
}
Emailer represents a service that can send emails.
type EnvironmentConfig ¶
type EnvironmentConfig struct {
// contains filtered or unexported fields
}
EnvironmentConfig is the configuration for a given environment.
func GetConfigForEnvironment ¶
func GetConfigForEnvironment(env string) *EnvironmentConfig
func (*EnvironmentConfig) BaseURL ¶
func (c *EnvironmentConfig) BaseURL() template.URL
BaseURL returns the BaseURL field.
func (*EnvironmentConfig) OutboundInvitesEmailAddress ¶
func (c *EnvironmentConfig) OutboundInvitesEmailAddress() string
OutboundInvitesEmailAddress returns the OutboundInvitesEmailAddress field.
func (*EnvironmentConfig) PasswordResetCreationEmailAddress ¶
func (c *EnvironmentConfig) PasswordResetCreationEmailAddress() string
PasswordResetCreationEmailAddress returns the PasswordResetCreationEmailAddress field.
func (*EnvironmentConfig) PasswordResetRedemptionEmailAddress ¶
func (c *EnvironmentConfig) PasswordResetRedemptionEmailAddress() string
PasswordResetRedemptionEmailAddress returns the PasswordResetRedemptionEmailAddress field.
type NoopEmailer ¶
type NoopEmailer struct {
// contains filtered or unexported fields
}
NoopEmailer doesn't send emails.
func NewNoopEmailer ¶
func NewNoopEmailer() (*NoopEmailer, error)
NewNoopEmailer returns a new no-op NoopEmailer.
func (*NoopEmailer) SendEmail ¶
func (e *NoopEmailer) SendEmail(context.Context, *OutboundEmailMessage) error
SendEmail sends an email.
type OutboundEmailMessage ¶
type OutboundEmailMessage struct { ToAddress string ToName string FromAddress string FromName string Subject string HTMLContent string }
OutboundEmailMessage is a collection of fields that are useful for sending emails.
func BuildGeneratedPasswordResetTokenEmail ¶
func BuildGeneratedPasswordResetTokenEmail(recipient *types.User, passwordResetToken *types.PasswordResetToken, envCfg *EnvironmentConfig) (*OutboundEmailMessage, error)
BuildGeneratedPasswordResetTokenEmail builds an email notifying a user that they've been invited to join a account.
func BuildInviteMemberEmail ¶
func BuildInviteMemberEmail(accountInvitation *types.AccountInvitation, envCfg *EnvironmentConfig) (*OutboundEmailMessage, error)
BuildInviteMemberEmail builds an email notifying a user that they've been invited to join a account.
func BuildPasswordChangedEmail ¶
func BuildPasswordChangedEmail(recipient *types.User, envCfg *EnvironmentConfig) (*OutboundEmailMessage, error)
BuildPasswordChangedEmail builds an email notifying a user that they've been invited to join a account.
func BuildPasswordResetTokenRedeemedEmail ¶
func BuildPasswordResetTokenRedeemedEmail(recipient *types.User, envCfg *EnvironmentConfig) (*OutboundEmailMessage, error)
BuildPasswordResetTokenRedeemedEmail builds an email notifying a user that they've been invited to join a account.
func BuildUsernameReminderEmail ¶
func BuildUsernameReminderEmail(recipient *types.User, envCfg *EnvironmentConfig) (*OutboundEmailMessage, error)
BuildUsernameReminderEmail builds an email notifying a user that they've been invited to join a account.
func BuildVerifyEmailAddressEmail ¶
func BuildVerifyEmailAddressEmail(recipient *types.User, emailVerificationToken string, envCfg *EnvironmentConfig) (*OutboundEmailMessage, error)
BuildVerifyEmailAddressEmail builds an email notifying a user that they've been invited to join a account.