I am trying to send emails from VFP using CDO. This is a system that needs to send pdf images of invoices to 400+ customers.
I opened accounts in gmail, yahoo and hotmail and always get the same error message:
error 1429 Ole dispatch exception code 0 from CDO.Messsage.1:Transport error connecting to server
This is my code:
loCfg=CREATEOBJECT("CDO.Configuration") WITH loCfg.Fields ..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/sendusing") = 2 ..Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10 ..Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "myaccount@gmail.com" ..Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword" ..Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = .t. ..Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = .t. .Update ENDWITH
loMsg = CREATEOBJECT ("CDO.Message")
WITH loMsg ..Configuration = loCfg ..From = "myaccount@gmail.com" ..To = 'myotheraccount@hotmail.com' ..Subject = 'Enviamos factura electrónica' ..TextBody = 'Please find attached your invoice for the month of October 2017' ..AddAttachment('c:\invoices\fe_261_092017_1.pdf') ..Send() endwith
loCfg = NULL loMsg = NULL
Either with an attachment or without one, I get the same error. I configured gmail to accept sending from "unsafe" apps (is VFP an unsafe app?). Did the same in yahoo and in hotmail. But I always get the same error
What I am doing wrong? What is the workaround?
NOTE: this happens even if I try to send just one message, let alone 400+ TIA Rafael Copquin
--- Este correo electrónico ha sido comprobado en busca de virus por AVG. http://www.avg.com
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---