diff --git a/pkg/mail/mail.go b/pkg/mail/mail.go index f04add437..910589433 100644 --- a/pkg/mail/mail.go +++ b/pkg/mail/mail.go @@ -49,9 +49,9 @@ func SetupDialer(host string, port int, user, pass, from string) { defaultDialerError = errors.New("No port provided for SMTP") return } + if from == "" { - defaultDialerError = errors.New("Sender for SMTP is not set") - return + from = "placeholder@example.net" } if defaultDialerError != nil { diff --git a/system/commands/auth.go b/system/commands/auth.go index 9d7e10337..ac1f25393 100644 --- a/system/commands/auth.go +++ b/system/commands/auth.go @@ -97,12 +97,11 @@ func Auth(app serviceInitializer) *cobra.Command { ntf = service.DefaultAuthNotification ) - err = ntf.EmailConfirmation(ctx, "en", args[0], "notification-testing-token") - cli.HandleError(err) + // Update current settings to be sure that we do not have outdated values + cli.HandleError(service.DefaultSettings.UpdateCurrent(ctx)) err = ntf.PasswordReset(ctx, "en", args[0], "notification-testing-token") cli.HandleError(err) - }, } diff --git a/system/service/auth_notification.go b/system/service/auth_notification.go index 1bb7eb4dc..2b7491c57 100644 --- a/system/service/auth_notification.go +++ b/system/service/auth_notification.go @@ -64,8 +64,16 @@ func (svc authNotification) PasswordReset(ctx context.Context, lang string, emai } func (svc authNotification) newMail() *gomail.Message { - m := gomail.NewMessage() - m.SetAddressHeader("From", svc.settings.Auth.Mail.FromAddress, svc.settings.Auth.Mail.FromName) + var ( + m = mail.New() + addr = svc.settings.Auth.Mail.FromAddress + name = svc.settings.Auth.Mail.FromName + ) + + if addr != "" { + m.SetAddressHeader("From", addr, name) + } + return m }