satellite/email: Add support for unauthenticated, cleartext SMTP connections
Change-Id: I11b4852122764c1ede188ca40d5edb14f2c4ee72
This commit is contained in:
parent
02899dfae2
commit
6961d2e19d
@ -55,18 +55,20 @@ func (sender *SMTPSender) communicate(ctx context.Context, client *smtp.Client,
|
||||
// before creating SMTPSender
|
||||
host, _, _ := net.SplitHostPort(sender.ServerAddress)
|
||||
|
||||
// send smtp hello or ehlo msg and establish connection over tls
|
||||
err := client.StartTLS(&tls.Config{ServerName: host})
|
||||
if err != nil {
|
||||
return err
|
||||
if sender.Auth != nil {
|
||||
// send smtp hello or ehlo msg and establish connection over tls
|
||||
err := client.StartTLS(&tls.Config{ServerName: host})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = client.Auth(sender.Auth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
err = client.Auth(sender.Auth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = client.Mail(sender.From.Address)
|
||||
err := client.Mail(sender.From.Address)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -276,6 +276,11 @@ func setupMailService(log *zap.Logger, config Config) (*mailservice.Service, err
|
||||
},
|
||||
ServerAddress: mailConfig.SMTPServerAddress,
|
||||
}
|
||||
case "insecure":
|
||||
sender = &post.SMTPSender{
|
||||
From: *from,
|
||||
ServerAddress: mailConfig.SMTPServerAddress,
|
||||
}
|
||||
case "nomail":
|
||||
sender = simulate.NoMail{}
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user