feat(mail): don't try to authenticate when no username and password was provided
This commit is contained in:
parent
aed1ad6d96
commit
d47edac376
1 changed files with 4 additions and 1 deletions
|
@ -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 a new issue