From 7c789624d7da0a45c33519ff10830e6c1b97dd1e Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Mon, 26 Feb 2024 11:07:49 +0100 Subject: mod: update all dependencies Patch produced with the following commands: go mod edit -dropreplace=golang.org/x/crypto go get -t -u go mod tidy I dropped the replace of x/crypto. The only use for the fork from ProtonMail is for openpgp which has been deprecated by the official implementation. And aerc explicitly uses the correct import path where needed. go-smtp update was a bit harsh. The API was changed completely. Signed-off-by: Robin Jarry Tested-by: Bence Ferdinandy --- lib/send/smtp.go | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'lib/send/smtp.go') diff --git a/lib/send/smtp.go b/lib/send/smtp.go index 2cc53d25..b1679014 100644 --- a/lib/send/smtp.go +++ b/lib/send/smtp.go @@ -19,32 +19,23 @@ func connectSmtp(starttls bool, host string, domain string) (*smtp.Client, error } else { serverName = host[:strings.IndexRune(host, ':')] } - conn, err := smtp.Dial(host) + var conn *smtp.Client + var err error + if starttls { + conn, err = smtp.DialStartTLS(host, &tls.Config{ServerName: serverName}) + } else { + conn, err = smtp.Dial(host) + } if err != nil { return nil, errors.Wrap(err, "smtp.Dial") } if domain != "" { err := conn.Hello(domain) if err != nil { - return nil, errors.Wrap(err, "Hello") - } - } - if starttls { - if sup, _ := conn.Extension("STARTTLS"); !sup { - err := errors.New("STARTTLS requested, but not supported " + - "by this SMTP server. Is someone tampering with your " + - "connection?") - conn.Close() - return nil, err - } - if err = conn.StartTLS(&tls.Config{ - ServerName: serverName, - }); err != nil { conn.Close() - return nil, errors.Wrap(err, "StartTLS") + return nil, errors.Wrap(err, "Hello") } } - return conn, nil } @@ -122,7 +113,7 @@ func newSmtpSender( return nil, errors.Wrap(err, "conn.Mail") } for _, rcpt := range rcpts { - if err := s.conn.Rcpt(rcpt.Address); err != nil { + if err := s.conn.Rcpt(rcpt.Address, nil); err != nil { conn.Close() return nil, errors.Wrap(err, "conn.Rcpt") } -- cgit