From bf1eb39403ccb3a0413d842a243171840fb45f1d Mon Sep 17 00:00:00 2001 From: Aaron L Date: Mon, 14 May 2018 11:47:34 -0700 Subject: [PATCH] Port FromName fix from master Originally contributed by Max Howald --- config.go | 2 ++ confirm/confirm.go | 7 ++++--- recover/recover.go | 7 ++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/config.go b/config.go index e4ee2c50..64896dcb 100644 --- a/config.go +++ b/config.go @@ -87,6 +87,8 @@ type Config struct { Mail struct { // From is the email address authboss e-mails come from. From string + // FromName is the name authboss e-mails come from. + FromName string // SubjectPrefix is used to add something to the front of the authboss // email subjects. SubjectPrefix string diff --git a/confirm/confirm.go b/confirm/confirm.go index 02e48945..8bba1556 100644 --- a/confirm/confirm.go +++ b/confirm/confirm.go @@ -141,9 +141,10 @@ func (c *Confirm) SendConfirmEmail(ctx context.Context, to, token string) { url := fmt.Sprintf("%s%s?%s=%s", c.Paths.RootURL, p, url.QueryEscape(FormValueConfirm), url.QueryEscape(token)) email := authboss.Email{ - To: []string{to}, - From: c.Config.Mail.From, - Subject: c.Config.Mail.SubjectPrefix + "Confirm New Account", + To: []string{to}, + From: c.Config.Mail.From, + FromName: c.Config.Mail.FromName, + Subject: c.Config.Mail.SubjectPrefix + "Confirm New Account", } logger.Infof("sending confirm e-mail to: %s", to) diff --git a/recover/recover.go b/recover/recover.go index 08918478..82c9ab62 100644 --- a/recover/recover.go +++ b/recover/recover.go @@ -133,9 +133,10 @@ func (r *Recover) SendRecoverEmail(ctx context.Context, to, encodedToken string) url := fmt.Sprintf("%s%s?%s", r.Authboss.Config.Paths.RootURL, p, query.Encode()) email := authboss.Email{ - To: []string{to}, - From: r.Authboss.Config.Mail.From, - Subject: r.Authboss.Config.Mail.SubjectPrefix + "Password Reset", + To: []string{to}, + From: r.Authboss.Config.Mail.From, + FromName: r.Authboss.Config.Mail.FromName, + Subject: r.Authboss.Config.Mail.SubjectPrefix + "Password Reset", } ro := authboss.EmailResponseOptions{