ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   CDO email - transport failed to connect the server (https://www.excelbanter.com/excel-programming/436891-cdo-email-transport-failed-connect-server.html)

musicgold[_3_]

CDO email - transport failed to connect the server
 
Hi,

Please see the code below, I am trying to use to send a simple email. I am
getting the following error message: Run-time error '-2147220973 (580040213)'
The transport failed to connect the server.
What could be the problem?

Code:
Public Sub email()
On Error Resume Next
Dim objEmail, toemail, schema

schema = "http://schemas.microsoft.com/cdo/configuration/"
Set objEmail = CreateObject("CDO.Message")
With objEmail
.From = "
.To = "
.Subject = "Test Mail"
.Textbody = "The quick brown fox " & Chr(10) & "jumps over the lazy dog"

With .Configuration.Fields
.Item(schema & "sendusing") = 2
.Item(schema & "smtpserver") = "smtp.mail.yahoo.com"
.Item(schema & "smtpserverport") = 25
.Item(schema & "smtpauthenticate") = 1
.Item(schema & "sendusername") = "ABCD"
.Item(schema & "sendpassword") = "abcd"
End With
.Configuration.Fields.Update
.Send
End With

End Sub


All times are GMT +1. The time now is 02:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com