From e336fb3d60be1f0fed1dcef355ae452ae2cf0839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 22 Sep 2016 11:51:39 +0200 Subject: [PATCH] fix(smtp mailer): added timeout of 10 seconds to smpt mailer, fixes #2989 --- pkg/services/notifications/mailer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/services/notifications/mailer.go b/pkg/services/notifications/mailer.go index 309436cb7d9..91c75a1889e 100644 --- a/pkg/services/notifications/mailer.go +++ b/pkg/services/notifications/mailer.go @@ -12,6 +12,7 @@ import ( "net/smtp" "os" "strings" + "time" "github.com/grafana/grafana/pkg/log" "github.com/grafana/grafana/pkg/setting" @@ -66,7 +67,7 @@ func sendToSmtpServer(recipients []string, msgContent []byte) error { tlsconfig.Certificates = []tls.Certificate{cert} } - conn, err := net.Dial("tcp", net.JoinHostPort(host, port)) + conn, err := net.DialTimeout("tcp", net.JoinHostPort(host, port), time.Second*10) if err != nil { return err }