Hello, I am new to this forum.

We use Google Apps as our mail provider. I have been sending my CDO mail through go daddy prior, but I am starting to have some issues where their mail server is being tagged for SPAM and some of my website messages are not getting through. So I'm trying to switch to the Google SMTP server. I have done everything I can find online, yet I still get the following error message:

CDO.Message.1 error '80040213'

The transport failed to connect to the server.

Here is my code:
Code:
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

' send one copy with Google SMTP server (with autentication)
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = "smtp.gmail.com" 
Flds.Item(schema & "smtpserverport") = 465
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = "myname@mydomain.com"
Flds.Item(schema & "sendpassword") =  "mypassword"
Flds.Item(schema & "smtpusessl") = 1
Flds.Update

With iMsg
.To = "sendername"
.From = "myname@mydomain.com"
.Subject = "Test send with gmail account"
.HTMLBody = message
Set .Configuration = iConf
SendEmailGmail = .Send
End With

set iMsg = nothing
set iConf = nothing
set Flds = nothing
Any idea why I am getting this error?