Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write: broken pipe #121

Open
arundudeemmt opened this issue Aug 1, 2018 · 0 comments
Open

write: broken pipe #121

arundudeemmt opened this issue Aug 1, 2018 · 0 comments

Comments

@arundudeemmt
Copy link

when using gomail it works fine in first go but after hour which is like default timeout of smtp servers, if email is sent then a following error is thrown : gomail: could not send email 1: write tcp XXXXXXXX:8807->YYYYYYYYYYY:25: write: broken pipe

Looked at code but seems we are checking io.eof error only and we do dial again but there in other cases error is not handled .

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)
}
}
}
return err
}
IMO we need to do sc, derr := c.d.Dial() in other error conditions too .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant