0
多的错误响应
我使用这个代码:golang:读取smtp.SendMail
err := smtp.SendMail(
smtpHostPort,
auth,
sender,
[]string{recipient},
[]byte(message),
)
if err != nil {
log.Printf("sendSmtp: failure: %q", strings.Split(err.Error(), "\n"))
}
然而,多行错误的反应似乎截断:
2013/02/06 11:54:41 sendSmtp: failure: ["530 5.5.1 Authentication Required. Learn more at"]
我怎样才能得到充分的多错误响应?
所以它看起来像你正在创建的错误对象,而不是直接监听返回错误字符串。是不是可能从函数中获得多行错误? – Xeoncross
据我可以从源头追踪,smtp.SendMail最终调用textproto.ReadResponse读取多行响应: smtp.SendMail: http://golang.org/src/pkg/net/smtp/smtp。去 textproto.ReadResponse: http://golang.org/src/pkg/net/textproto/reader.go // ReadResponse读取形式的多行响应: // // 代码\t - 消息行1 // \t代码消息行2 // \t ... // \t代码消息行n 这可能是一个错误? – Everton