fix TLS for email sending

This commit is contained in:
Christoph Haas 2021-03-22 22:53:59 +01:00
parent 6ece6e5be9
commit 29cd73aa46

View File

@ -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)
}
}