Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

setting ssl to false

sy-records2913640a86b8
diff --git a/internal/service/export/email_service.go b/internal/service/export/email_service.go
index beec645d..03d9c182 100644
--- a/internal/service/export/email_service.go
+++ b/internal/service/export/email_service.go
@@ -74,7 +74,7 @@ type EmailConfig struct {
FromName string `json:"from_name"`
SMTPHost string `json:"smtp_host"`
SMTPPort int `json:"smtp_port"`
- Encryption string `json:"encryption"` // "" SSL
+ Encryption string `json:"encryption"` // "" SSL TLS
SMTPUsername string `json:"smtp_username"`
SMTPPassword string `json:"smtp_password"`
SMTPAuthentication bool `json:"smtp_authentication"`
@@ -84,6 +84,10 @@ func (e *EmailConfig) IsSSL() bool {
return e.Encryption == "SSL"
}
+func (e *EmailConfig) IsTLS() bool {
+ return e.Encryption == "TLS"
+}
+
// SaveCode save code
func (es *EmailService) SaveCode(ctx context.Context, code, codeContent string) {
err := es.emailRepo.SetCode(ctx, code, codeContent, 10*time.Minute)
@@ -135,6 +139,9 @@ func (es *EmailService) Send(ctx context.Context, toEmailAddr, subject, body str
if ec.IsSSL() {
d.SSL = true
}
+ if ec.IsTLS() {
+ d.SSL = false
+ }
if len(os.Getenv("SKIP_SMTP_TLS_VERIFY")) > 0 {
d.TLSConfig = &tls.Config{ServerName: d.Host, InsecureSkipVerify: true}
}