go - Golang smtp.SendMail blocking -
i tried use smtp.sendmail() in go program. blocks , doesn't return until times out. prevents me finding out wrong.
my code:
to := []string{"recepient@example.com"} err := smtp.sendmail("smtp.web.de:25", smtp.crammd5auth("example@web.de", "password"), "example@web.de", to, []byte("hi")) if err != nil { fmt.println(err) }else{ fmt.println("success") } after long time following error:
dial tcp 213.165.67.124:25: connection timed out any ideas might real problem?
if seeing timeout can try using net.dial directly verify connectivity :
conn, err := net.dial("tcp", "smtp.web.de:25") if err != nil { fmt.println(err) } if not connecting there local blocking socket. ask local network guys firewall setup or if there network proxy type devices intercepting outgoing traffic.
Comments
Post a Comment