Documentation ¶
Index ¶
- Constants
- type EmailData
- type EmailParams
- type MailClient
- type Mailer
- type TemplateMailer
- func (m *TemplateMailer) ConfirmationMail(r *http.Request, user *models.User, otp, referrerURL string, ...) error
- func (m *TemplateMailer) EmailChangeMail(r *http.Request, user *models.User, otpNew, otpCurrent, referrerURL string, ...) error
- func (m TemplateMailer) GetEmailActionLink(user *models.User, actionType, referrerURL string, externalURL *url.URL) (string, error)
- func (m *TemplateMailer) InviteMail(r *http.Request, user *models.User, otp, referrerURL string, ...) error
- func (m *TemplateMailer) MagicLinkMail(r *http.Request, user *models.User, otp, referrerURL string, ...) error
- func (m *TemplateMailer) ReauthenticateMail(r *http.Request, user *models.User, otp string) error
- func (m *TemplateMailer) RecoveryMail(r *http.Request, user *models.User, otp, referrerURL string, ...) error
- func (m TemplateMailer) Send(user *models.User, subject, body string, data map[string]interface{}) error
- func (m TemplateMailer) ValidateEmail(email string) error
Constants ¶
const ( SignupVerification = "signup" RecoveryVerification = "recovery" InviteVerification = "invite" MagicLinkVerification = "magiclink" EmailChangeVerification = "email_change" EmailOTPVerification = "email" EmailChangeCurrentVerification = "email_change_current" EmailChangeNewVerification = "email_change_new" ReauthenticationVerification = "reauthentication" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmailParams ¶
type MailClient ¶
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 ValidateEmail(email string) error GetEmailActionLink( user *models.User, actionType, referrerURL string, externalURL *url.URL, ) (string, error) }
Mailer defines the interface a mailer must implement.
func NewMailer ¶
func NewMailer(globalConfig *conf.GlobalConfiguration) Mailer
NewMailer returns a new gotrue mailer
type TemplateMailer ¶
type TemplateMailer struct { SiteURL string Config *conf.GlobalConfiguration Mailer MailClient }
TemplateMailer will send mail and use templates from the site for easy mail styling
func (*TemplateMailer) ConfirmationMail ¶
func (m *TemplateMailer) ConfirmationMail( r *http.Request, user *models.User, otp, referrerURL string, externalURL *url.URL, ) error
ConfirmationMail sends a signup confirmation mail to a new user
func (*TemplateMailer) EmailChangeMail ¶
func (m *TemplateMailer) EmailChangeMail( r *http.Request, user *models.User, otpNew, otpCurrent, referrerURL string, externalURL *url.URL, ) error
EmailChangeMail sends an email change confirmation mail to a user
func (TemplateMailer) GetEmailActionLink ¶
func (m TemplateMailer) GetEmailActionLink( user *models.User, actionType, referrerURL string, externalURL *url.URL, ) (string, error)
GetEmailActionLink returns a magiclink, recovery or invite link based on the actionType passed.
func (*TemplateMailer) InviteMail ¶
func (m *TemplateMailer) InviteMail( r *http.Request, user *models.User, otp, referrerURL string, externalURL *url.URL, ) error
InviteMail sends a invite mail to a new user
func (*TemplateMailer) MagicLinkMail ¶
func (m *TemplateMailer) MagicLinkMail( r *http.Request, user *models.User, otp, referrerURL string, externalURL *url.URL, ) error
MagicLinkMail sends a login link mail
func (*TemplateMailer) ReauthenticateMail ¶
ReauthenticateMail sends a reauthentication mail to an authenticated user
func (*TemplateMailer) RecoveryMail ¶
func (m *TemplateMailer) RecoveryMail( r *http.Request, user *models.User, otp, referrerURL string, externalURL *url.URL, ) error
RecoveryMail sends a password recovery mail
func (TemplateMailer) Send ¶
func (m TemplateMailer) Send( user *models.User, subject, body string, data map[string]interface{}, ) error
Send can be used to send one-off emails to users
func (TemplateMailer) ValidateEmail ¶
func (m TemplateMailer) ValidateEmail(email string) error
ValidateEmail returns nil if the email is valid, otherwise an error indicating the reason it is invalid