Commit b8b7c3b111

b8b7c3b111678afc51f3595d673d9a3ac7c3c884

parent: 1364cf765d

Verified · cmc

cmc <hello@cleberg.net> · 2026-08-24 15:12 UTC

mail: STARTTLS needs a ServerName

StartTLS(nil) fails against any real relay; pass the SMTP host name.
Unexposed by the e2e fake, which does not advertise STARTTLS.

Layout: unified · split

internal/mail/mail.go +2 −1
@@ -4,6 +4,7 @@
4package mail 4package mail
5 5
6import ( 6import (
7 "crypto/tls"
7 "fmt" 8 "fmt"
8 "net" 9 "net"
9 "net/smtp" 10 "net/smtp"
@@ -35,7 +36,7 @@ func Send(cfg config.Config, to, subject, body string) error {
35 } 36 }
36 defer c.Close() 37 defer c.Close()
37 if ok, _ := c.Extension("STARTTLS"); ok { 38 if ok, _ := c.Extension("STARTTLS"); ok {
38 if err := c.StartTLS(nil); err != nil { 39 if err := c.StartTLS(&tls.Config{ServerName: hostname}); err != nil {
39 return fmt.Errorf("starttls: %w", err) 40 return fmt.Errorf("starttls: %w", err)
40 } 41 }
41 } 42 }