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
|
// before creating SMTPSender
|
||||||
host, _, _ := net.SplitHostPort(sender.ServerAddress)
|
host, _, _ := net.SplitHostPort(sender.ServerAddress)
|
||||||
|
|
||||||
// send smtp hello or ehlo msg and establish connection over tls
|
if sender.Auth != nil {
|
||||||
err := client.StartTLS(&tls.Config{ServerName: host})
|
// send smtp hello or ehlo msg and establish connection over tls
|
||||||
if err != nil {
|
err := client.StartTLS(&tls.Config{ServerName: host})
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = client.Auth(sender.Auth)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = client.Auth(sender.Auth)
|
err := client.Mail(sender.From.Address)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
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