increase smtp timeout to 30 seconds

This commit is contained in:
Christoph Haas 2021-04-29 17:04:26 +02:00
parent 9a420d26e1
commit 0d4e12a6c1

View File

@ -4,6 +4,7 @@ import (
"crypto/tls"
"io"
"io/ioutil"
"time"
"github.com/pkg/errors"
mail "github.com/xhit/go-simple-mail/v2"
@ -47,6 +48,8 @@ type MailAttachment struct {
func SendEmailWithAttachments(cfg MailConfig, sender, replyTo, subject, body, htmlBody string, receivers []string, attachments []MailAttachment) error {
srv := mail.NewSMTPClient()
srv.ConnectTimeout = 30 * time.Second
srv.SendTimeout = 30 * time.Second
srv.Host = cfg.Host
srv.Port = cfg.Port
srv.Username = cfg.Username