diff --git a/internal/common/email.go b/internal/common/email.go index e25da1d..b4bbd59 100644 --- a/internal/common/email.go +++ b/internal/common/email.go @@ -71,9 +71,9 @@ func SendEmailWithAttachments(cfg MailConfig, sender, replyTo, subject, body str } } - if cfg.CertValidation { - return e.Send(hostname, auth) + if cfg.TLS { + return e.SendWithStartTLS(hostname, auth, &tls.Config{InsecureSkipVerify: !cfg.CertValidation}) } else { - return e.SendWithStartTLS(hostname, auth, &tls.Config{InsecureSkipVerify: true}) + return e.Send(hostname, auth) } }