Beispiel #1
0
func (r *Recover) sendRecoverEmail(to, encodedToken string) {
	p := path.Join(r.MountPath, "recover/complete")
	url := fmt.Sprintf("%s%s?token=%s", r.RootURL, p, encodedToken)

	email := authboss.Email{
		To:      []string{to},
		From:    r.EmailFrom,
		Subject: r.EmailSubjectPrefix + "Password Reset",
	}

	if err := response.Email(r.Mailer, email, r.emailHTMLTemplates, tplInitHTMLEmail, r.emailTextTemplates, tplInitTextEmail, url); err != nil {
		fmt.Fprintln(r.LogWriter, "recover: failed to send recover email:", err)
	}
}
Beispiel #2
0
// confirmEmail sends a confirmation e-mail.
func (c *Confirm) confirmEmail(ctx *authboss.Context, to, token string) {
	p := path.Join(c.MountPath, "confirm")
	url := fmt.Sprintf("%s%s?%s=%s", c.RootURL, p, url.QueryEscape(FormValueConfirm), url.QueryEscape(token))

	email := authboss.Email{
		To:      []string{to},
		From:    c.EmailFrom,
		Subject: c.EmailSubjectPrefix + "Confirm New Account",
	}

	err := response.Email(ctx.Mailer, email, c.emailHTMLTemplates, tplConfirmHTML, c.emailTextTemplates, tplConfirmText, url)
	if err != nil {
		fmt.Fprintf(ctx.LogWriter, "confirm: Failed to send e-mail: %v", err)
	}
}