From 6571e8d5f003496cb15cfe736ffb5b1abf4e2e7a Mon Sep 17 00:00:00 2001 From: Arun Dudee Date: Sat, 11 Aug 2018 16:40:48 +0530 Subject: [PATCH] fixing redial issue, in case of error we need to dial again --- smtp.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/smtp.go b/smtp.go index 2aa49c8..f3c55df 100644 --- a/smtp.go +++ b/smtp.go @@ -144,14 +144,12 @@ type smtpSender struct { func (c *smtpSender) Send(from string, to []string, msg io.WriterTo) error { if err := c.Mail(from); err != nil { - if err == io.EOF { - // This is probably due to a timeout, so reconnect and try again. - sc, derr := c.d.Dial() - if derr == nil { - if s, ok := sc.(*smtpSender); ok { - *c = *s - return c.Send(from, to, msg) - } + // This is probably due to a timeout, so reconnect and try again. + sc, derr := c.d.Dial() + if derr == nil { + if s, ok := sc.(*smtpSender); ok { + *c = *s + return c.Send(from, to, msg) } } return err