[BUG] There is an issue in the Validate function where it panics, root cause is in the runSession function
rahultyagidev opened this issue · comments
The bug is in the runSession function when creating smtp client we ignore the error, however calling either Send or Close in case there is an error causes panic
New bug checklist
- I have updated
truemail-go
to the latest version - I have read the Contribution Guidelines
- I have read the documentation
- I have searched for existing GitHub issues
Bug description
The bug is in the runSession function when creating smtp client we ignore the error on line 105, however calling either Send or Close in case there is an error causes panic:
Hi, @rahultyagidev! Thanks for your report. I'll take a look deeply.
Hi, is there any update on this case/bug reports?
Recently I also stumbling into the same issue where the module will resulting runtime error.
The runtime error only happen when initial connection to MX server is failed/instantly rejected.
I do some testing to actually handle the smtp.NewClient error in smtp_client.go instead of ignoring it, below are the changes:
before:
client, _ := smtp.NewClient(connection, smtpClient.targetServerAddress)
after:
client, err := smtp.NewClient(connection, smtpClient.targetServerAddress)
// Handle connection to MX failed
if err != nil {
closeConnection()
return false
}
IDK if that's the correct/best solution or not, but when I try to reproduce the error again using my test above the error is not appearing again.
@RichiMaulana The real cause of this error was the wrong SMTP service ready status 🥇