From 9c8a1df01fee10d9b3728dc9cf3480b80e547bd9 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Thu, 29 Apr 2021 10:59:00 +0200 Subject: [PATCH] Set server name in TLS config (#13) --- internal/common/email.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/common/email.go b/internal/common/email.go index 781e49d..af65188 100644 --- a/internal/common/email.go +++ b/internal/common/email.go @@ -89,9 +89,9 @@ func SendEmailWithAttachments(cfg MailConfig, sender, replyTo, subject, body str switch cfg.Encryption { case MailEncryptionTLS: - return e.SendWithTLS(hostname, auth, &tls.Config{InsecureSkipVerify: !cfg.CertValidation}) + return e.SendWithTLS(hostname, auth, &tls.Config{ServerName: cfg.Host, InsecureSkipVerify: !cfg.CertValidation}) case MailEncryptionStartTLS: - return e.SendWithStartTLS(hostname, auth, &tls.Config{InsecureSkipVerify: !cfg.CertValidation}) + return e.SendWithStartTLS(hostname, auth, &tls.Config{ServerName: cfg.Host, InsecureSkipVerify: !cfg.CertValidation}) default: // MailEncryptionNone return e.Send(hostname, auth) }