Golang and net/smtp: ReadResponse() never returns

Viewed 56

I want to read the response from a net/smtp connection like this:

c, err := smtp.Dial(mailHost + ":25")
if err != nil {
    return or, err
}
defer c.Quit()

expectedCode := 2
_, banner, err := c.Text.ReadResponse(expectedCode)

However, readResponse() never returns. When I debug the code with delve, I can see that the buffer has the response, padded with NULs.

Does it still wait for data? How can I fix this?

Thanks!

0 Answers
Related