mirror of
https://github.com/therootcompany/golib.git
synced 2026-11-04 06:55:00 +00:00
fix(formmailer): set tls.Config.ServerName on StartTLS
This commit is contained in:
parent
5b16fc26df
commit
a16aa6f73f
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user