From 32d0206af0e752d7d68db460ca9e089af15dc59a Mon Sep 17 00:00:00 2001 From: Mark Gardner Date: Thu, 21 Apr 2022 11:29:15 -0500 Subject: [PATCH] throw an error if the remote is configured for starttls and the server does not have the extension --- smtp.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/smtp.go b/smtp.go index e5bdd69..14ab8c1 100644 --- a/smtp.go +++ b/smtp.go @@ -374,6 +374,8 @@ func SendMail(r *Remote, from string, to []string, msg []byte) error { if err = c.StartTLS(config); err != nil { return err } + } else if r.Scheme == "starttls" { + return errors.New("starttls: server does not support extension, check remote scheme") } } if r.Auth != nil && c.ext != nil {