I am using this code:
err := smtp.SendMail(
smtpHostPort,
auth,
sender,
[]string{recipient},
[]byte(message),
)
if err != nil {
log.Printf("sendSmtp: failure: %q", strings.Split(err.Error(), "
"))
}
However the multiline error response seems truncated:
2013/02/06 11:54:41 sendSmtp: failure: ["530 5.5.1 Authentication Required. Learn more at"]
How can I get the full multiline error response?
For the records, this bug has been fixed:
The error is not a multi-line string.
package main
import (
"errors"
"log"
"strings"
)
func main() {
err := errors.New("530 5.5.1 Authentication Required. Learn more at")
log.Printf("sendSmtp: failure: %q", strings.Split(err.Error(), "
"))
err = errors.New("530 5.5.1 Authentication Required. Learn more at
stackoverflow.com")
log.Printf("sendSmtp: failure: %q", strings.Split(err.Error(), "
"))
}
Output:
2013/02/06 13:30:19 sendSmtp: failure: ["530 5.5.1 Authentication Required. Learn more at"]
2013/02/06 13:30:19 sendSmtp: failure: ["530 5.5.1 Authentication Required. Learn more at" "stackoverflow.com"]