From 0d4e12a6c18db8a749c4b553ed32986accbf557a Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Thu, 29 Apr 2021 17:04:26 +0200 Subject: [PATCH] increase smtp timeout to 30 seconds --- internal/common/email.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/common/email.go b/internal/common/email.go index 7f43311..37578fb 100644 --- a/internal/common/email.go +++ b/internal/common/email.go @@ -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