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 (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/tls"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
@ -384,7 +385,7 @@ func (fm *FormMailer) sendMail(ctx context.Context, msg []byte) error {
|
|||||||
defer func() { _ = c.Close() }()
|
defer func() { _ = c.Close() }()
|
||||||
|
|
||||||
if ok, _ := c.Extension("STARTTLS"); ok {
|
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)
|
return fmt.Errorf("starttls: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user