View Single Post
 
Old 07-06-2015, 01:39 AM
Maany Maany is offline
Newcomer
 
Join Date: Nov 2014
Posts: 9
Question Email with CDO "the transport failed to connect to the server"

Hey all,

I'm trying to send an email from my app using CDO, unfortunately i don't have admin rights on my pc (not sure if this is the cause for the problem) whenever my app tries to send an email i get the "the transport failed to connect to the server" error, have tried increasing timeout and even creating a new gmail account with no use.

any idea how to fix it ? it's driving me crazy !

Code:
Dim ObjSendMail
    Set ObjSendMail = CreateObject("CDO.Message")
    With ObjSendMail.Configuration.Fields
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2  
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
 .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 1000
   .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username@gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "userpassword"
.Update
    End With
    If Text24.Text = "" Then
        ObjSendMail.To = "receipnt@email.com"
    Else
        ObjSendMail.To = Text24.Text 
    End If
    
    ObjSendMail.Subject = MSG_TEXT
    ObjSendMail.From = "sender@gmail.com"

    ObjSendMail.HTMLBody = MSG_TEXT 

    ObjSendMail.Send

    Set ObjSendMail = Nothing
Reply With Quote