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