(Split from: How to make Access to send an e-mail without using outlook. )
Hi Seth...
It has been a long time since you have answered my question. I've starting my studies using the outlook as a way to transmit my e-mails from Access and just now I tryed to use Gmail as the server.
But after copying the code of the link you have suggested into my code, I got the following error:
Fail in the conection of the transport with the server.
CDO.Message 1
Could you please help me to understand what is wrong?
My code is written below:
I got the error in the .send procedure.
Could you please help me?
Best regards
Hi Seth...
It has been a long time since you have answered my question. I've starting my studies using the outlook as a way to transmit my e-mails from Access and just now I tryed to use Gmail as the server.
But after copying the code of the link you have suggested into my code, I got the following error:
Fail in the conection of the transport with the server.
CDO.Message 1
Could you please help me to understand what is wrong?
My code is written below:
Code:
Private Sub Comando3_Click()
On Error GoTo Err_Comando3_Click
Set cdomsg = CreateObject("CDO.message")
With cdomsg.Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'NTLM method
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smptserverport") = 465
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "mygmail@gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword"
.Update
End With
' build email parts
With cdomsg
.To = "somebody@somedomain.com"
.From = "mygmail@gmail.com"
.Subject = "Test"
.TextBody = "Teste."
.Send
End With
Set cdomsg = Nothing
Exit_Comando3_Click:
Exit Sub
Err_Comando3_Click:
Call ErrMsg("Private Sub Comando3_Click()")
Resume Exit_Comando3_Click
End Sub
Could you please help me?
Best regards
Comment