smtp.Dial("ASPMX.L.GOOGLE.COM:25")连接错误;但是腻子连接有效
smtp.Dial("ASPMX.L.GOOGLE.COM:25") connection error; but putty connections work
使用 Go 和 smtp.Dial
时,
甚至 net.Dial
,
我收到错误:
dial tcp 64.233.169.27:25: ConnectEx tcp: A connection attempt failed
because the connected party did not properly respond after a period of
time, or established connection failed because connected host has
failed to respond.
来自这段代码:
mxClient, err := smtp.Dial("ASPMX.L.GOOGLE.COM:25")
if err != nil {
fmt.Println(err)
}
我不明白的是,我可以在没有 TLS 的情况下在端口 25 上使用 putty 连接和发送命令(HELO
等)。
如果这是无法建立连接的包的限制,
是否有推荐的方法来建立像 Go 中的 putty 那样的原始套接字连接?
我的机器上没有发现任何错误。
package main
import (
"fmt"
"net/smtp"
)
func main() {
mxClient, err := smtp.Dial("ASPMX.L.GOOGLE.COM:25")
if err != nil {
fmt.Println(err)
}
fmt.Printf("%#v", mxClient)
}
给予
&smtp.Client{Text:(*textproto.Conn)(0xc208074000), conn:(*net.TCPConn)(0xc20802c018), tls:false, serverName:"ASPMX.L.GOOGLE.COM", ext:map[string]string(nil), auth:[]string(nil), localName:"localhost", didHello:false, helloError:error(nil)}
您的 ISP 可能阻止了端口 25。我必须使用端口 587 来连接 google smtp 服务器。
使用 Go 和 smtp.Dial
时,
甚至 net.Dial
,
我收到错误:
dial tcp 64.233.169.27:25: ConnectEx tcp: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
来自这段代码:
mxClient, err := smtp.Dial("ASPMX.L.GOOGLE.COM:25")
if err != nil {
fmt.Println(err)
}
我不明白的是,我可以在没有 TLS 的情况下在端口 25 上使用 putty 连接和发送命令(HELO
等)。
如果这是无法建立连接的包的限制,
是否有推荐的方法来建立像 Go 中的 putty 那样的原始套接字连接?
我的机器上没有发现任何错误。
package main
import (
"fmt"
"net/smtp"
)
func main() {
mxClient, err := smtp.Dial("ASPMX.L.GOOGLE.COM:25")
if err != nil {
fmt.Println(err)
}
fmt.Printf("%#v", mxClient)
}
给予
&smtp.Client{Text:(*textproto.Conn)(0xc208074000), conn:(*net.TCPConn)(0xc20802c018), tls:false, serverName:"ASPMX.L.GOOGLE.COM", ext:map[string]string(nil), auth:[]string(nil), localName:"localhost", didHello:false, helloError:error(nil)}
您的 ISP 可能阻止了端口 25。我必须使用端口 587 来连接 google smtp 服务器。