【发布时间】:2019-04-29 12:14:49
【问题描述】:
我有使用来自 Internet 的 CDO 发送电子邮件的代码 - 但我不断收到消息“传输无法连接到服务器”
我尝试了各种服务器交换的设置更改,但没有成功。
`````
strSubject = "Results from Excel Spreadsheet"
strFrom = "jceast7@hotmail.com" '"rdube02@gmail.com"
strTo = "jceast7@hotmail.com" '"rdube02@gmail.com"
strCc = ""
strBcc = ""
strBody = "The total results for this quarter are: " '& Str
'STEP 3
'The next section of code is where you will configure CDO to use any
external SMTP server to send the email.
Set CDO_Mail = CreateObject("CDO.Message")
On Error GoTo Error_Handling
Set CDO_Config = CreateObject("CDO.Configuration")
CDO_Config.Load -1
Set SMTP_Config = CDO_Config.Fields
With SMTP_Config
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "Microsoft Exchange" '"smtp.hotmail.com" '"smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")
= 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername")
= "jceast7@hotmail.com" '"email@website.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")
= "123456"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Update
End With
With CDO_Mail
Set .Configuration = CDO_Config
End With
``````
【问题讨论】:
-
我不知道Hotmail,但是使用GMail,您可以登录并转到选项并勾选允许未知邮件程序(例如CDO)使用GMail。
-
我正在寻找连接 CDO 和 Outlook / Hotmail 的选项 - 还没有