传输无法连接到服务器错误

时间:2016-03-31 06:37:15

标签: email vbscript

Set emailObj      = CreateObject("CDO.Message")

emailObj.Sender   = "zzz@xxx.com"
emailObj.To       = "xxx@xxx.com"

emailObj.Subject  = "Test CDO"
emailObj.TextBody = "Test CDO"

Set emailConfig   = emailObj.Configuration

emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.live.com"
emailConfig.Fields("----/smtpserverport")   = 465
emailConfig.Fields("----/sendusing")        = 2  
emailConfig.Fields("----/smtpauthenticate") = 1  
emailConfig.Fields("----/smtpusessl")       = true 
emailConfig.Fields("----/sendusername")     = "xxxx@gmail.com"
emailConfig.Fields("----/sendpassword")     = "*****"

emailConfig.Fields.Update

emailObj.Send

If Err.Number = 0 Then 
  MsgBox "Done"
End If

If Err.Number <> 0 Then 
  MsgBox "Can't Proceed"
End If

这是通过live.com发送电子邮件的代码,但我收到“传输无法连接到服务器”错误。任何人都可以帮我解决这个错误吗?

1 个答案:

答案 0 :(得分:1)

mail.live.com只是一个网络服务器(农场):

xxx@iridium:~ $ nmap mail.live.com

Starting Nmap 6.47 ( http://nmap.org ) at 2016-03-31 08:53 CEST
Nmap scan report for mail.live.com (157.56.198.204)
Host is up (0.029s latency).
Other addresses for mail.live.com (not scanned): 157.55.230.252
rDNS record for 157.56.198.204: origin.du130w.dub130.mail.live.com
Not shown: 965 closed ports, 33 filtered ports
PORT    STATE SERVICE
80/tcp  open  http
443/tcp open  https

Nmap done: 1 IP address (1 host up) scanned in 8.32 seconds

要向outlook.com提交邮件,请使用smtp-mail.outlook.com和端口25或587(参见here)。

不确定您是否可以使用Gmail地址对Microsoft的邮件服务进行身份验证。