Skip to content

Commit 9521426

Browse files
committed
fix: smtp tls config
1 parent 068dd41 commit 9521426

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [unreleased]
99

10+
## [0.17.4] - 2024-02-08
11+
12+
- Adds `TLSConfig` to SMTP settings.
13+
- `TLSConfig` is always passed to gomail so that it can be used when gomail uses `STARTTLS` to upgrade the connection to TLS.
14+
1015
## [0.17.3] - 2023-12-12
1116

1217
- CI/CD changes

ingredients/emaildelivery/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,13 @@ func SendSMTPEmail(settings SMTPSettings, content EmailContent) error {
5959

6060
d := gomail.NewDialer(settings.Host, settings.Port, username, settings.Password)
6161

62-
if settings.Secure {
62+
if settings.TLSConfig != nil {
63+
d.TLSConfig = settings.TLSConfig
64+
} else {
6365
d.TLSConfig = &tls.Config{InsecureSkipVerify: true, ServerName: settings.Host}
66+
}
67+
68+
if settings.Secure {
6469
d.SSL = true
6570
}
6671
return d.DialAndSend(m)

ingredients/emaildelivery/smtpmodels.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@
1717
package emaildelivery
1818

1919
import (
20+
"crypto/tls"
21+
2022
"github.com/supertokens/supertokens-golang/supertokens"
2123
)
2224

2325
type SMTPSettings struct {
24-
Host string
25-
From SMTPFrom
26-
Port int
27-
Username *string
28-
Password string
29-
Secure bool
26+
Host string
27+
From SMTPFrom
28+
Port int
29+
Username *string
30+
Password string
31+
Secure bool
32+
TLSConfig *tls.Config
3033
}
3134

3235
type SMTPFrom struct {

supertokens/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const (
2121
)
2222

2323
// VERSION current version of the lib
24-
const VERSION = "0.17.3"
24+
const VERSION = "0.17.4"
2525

2626
var (
2727
cdiSupported = []string{"3.0"}

0 commit comments

Comments
 (0)