Skip to content

Commit

Permalink
Do not use plainAuth when no user or password. Fixes superseriousbusi…
Browse files Browse the repository at this point in the history
  • Loading branch information
yonas committed Sep 19, 2024
1 parent 8effc77 commit b0bcc1d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/email/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,18 @@ func NewSender() (Sender, error) {
port := config.GetSMTPPort()
from := config.GetSMTPFrom()
msgIDHost := config.GetHost()
var smtpAuth smtp.Auth

if (username == "" || password == "") {
smtpAuth = nil
} else {
smtpAuth = smtp.PlainAuth("", username, password, host)
}

return &sender{
hostAddress: fmt.Sprintf("%s:%d", host, port),
from: from,
auth: smtp.PlainAuth("", username, password, host),
auth: smtpAuth,
msgIDHost: msgIDHost,
template: t,
}, nil
Expand Down

0 comments on commit b0bcc1d

Please sign in to comment.