I have code for emailing using CDO from internet - but I keep getting the message " The transport failed to connect to the server"
I have tried various setting changes for server exchange but no luck.
`````
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
``````
" The transport failed to connect to the server"
该错误意味着您需要在网站(Google或其他任何网站)上登录您的帐户,然后选择“允许外部程序使用电子邮件”(类似方法),它对我有用,我和您在同一个地方!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.