3
0

Fix default-addr and test-email sending

This commit is contained in:
Denis Arh
2020-09-02 12:37:00 +02:00
parent d6c9bd08fa
commit e1ded02615
3 changed files with 15 additions and 4 deletions
+2 -2
View File
@@ -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 {
+3
View File
@@ -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)
+10 -2
View File
@@ -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
}