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 eac2ca9ec..10ebc4571 100644 --- a/system/commands/auth.go +++ b/system/commands/auth.go @@ -121,6 +121,9 @@ func Auth() *cobra.Command { ntf = service.DefaultAuthNotification.With(ctx) ) + // Update current settings to be sure that we do not have outdated values + cli.HandleError(service.DefaultSettings.UpdateCurrent(ctx)) + err = ntf.EmailConfirmation("en", args[0], "notification-testing-token") cli.HandleError(err) diff --git a/system/service/auth_notification.go b/system/service/auth_notification.go index de56dc170..05f610ec8 100644 --- a/system/service/auth_notification.go +++ b/system/service/auth_notification.go @@ -75,8 +75,16 @@ func (svc authNotification) PasswordReset(lang string, emailAddress string, toke } 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 }