From a16aa6f73f57eb3de57ca3a5b10b747158d43df9 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 20 Apr 2026 22:38:49 -0600 Subject: [PATCH] fix(formmailer): set tls.Config.ServerName on StartTLS --- net/formmailer/formmailer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/formmailer/formmailer.go b/net/formmailer/formmailer.go index f610046..fefb341 100644 --- a/net/formmailer/formmailer.go +++ b/net/formmailer/formmailer.go @@ -36,6 +36,7 @@ package formmailer import ( "bytes" "context" + "crypto/tls" "errors" "fmt" "log" @@ -384,7 +385,7 @@ func (fm *FormMailer) sendMail(ctx context.Context, msg []byte) error { defer func() { _ = c.Close() }() if ok, _ := c.Extension("STARTTLS"); ok { - if err := c.StartTLS(nil); err != nil { + if err := c.StartTLS(&tls.Config{ServerName: hostname}); err != nil { return fmt.Errorf("starttls: %w", err) } }