feat(mail): don't try to authenticate when no username and password was provided
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
aed1ad6d96
commit
d47edac376
@ -48,7 +48,6 @@ func getClient() (*mail.Client, error) {
|
||||
}
|
||||
|
||||
opts := []mail.Option{
|
||||
mail.WithSMTPAuth(authType),
|
||||
mail.WithPort(config.MailerPort.GetInt()),
|
||||
mail.WithTLSPolicy(tlsPolicy),
|
||||
//#nosec G402
|
||||
@ -58,6 +57,10 @@ func getClient() (*mail.Client, error) {
|
||||
}),
|
||||
}
|
||||
|
||||
if config.MailerUsername.GetString() != "" && config.MailerPassword.GetString() != "" {
|
||||
opts = append(opts, mail.WithSMTPAuth(authType))
|
||||
}
|
||||
|
||||
if config.MailerUsername.GetString() != "" {
|
||||
opts = append(opts, mail.WithUsername(config.MailerUsername.GetString()))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user