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 ---
Is your smtpconnectiontimeout setting of 10, too small? I've never changed that setting from whatever it's default is and send 100's of emails a day using similar code.
Fred
On Mon, Sep 25, 2017 at 8:21 AM, Rafael Copquin rafael.copquin@gmail.com wrote:
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/smtpc onnectiontimeout") = 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
[excessive quoting removed by server]
Hi, Please check and compare your code against the working procedure by Sergey :
https://www.berezniker.com/content/pages/visual-foxpro/send-email-gmail-acco...
Regards,
Koen
2017-09-25 17:30 GMT+02:00 Fred Taylor fbtaylor@gmail.com:
Is your smtpconnectiontimeout setting of 10, too small? I've never changed that setting from whatever it's default is and send 100's of emails a day using similar code.
Fred
On Mon, Sep 25, 2017 at 8:21 AM, Rafael Copquin rafael.copquin@gmail.com wrote:
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/smtpc onnectiontimeout") = 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.
.UpdateENDWITH
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
[excessive quoting removed by server]
I did that and it still does not work. I get the same error message Rafael
Enviado desde Correo para Windows 10
De: Koen Piller Enviado: lunes, 25 de septiembre de 2017 12:33 Para: profoxtech@leafe.com Asunto: Re: Email with CDO error
Hi, Please check and compare your code against the working procedure by Sergey :
https://www.berezniker.com/content/pages/visual-foxpro/send-email-gmail-acco...
Regards,
Koen
2017-09-25 17:30 GMT+02:00 Fred Taylor fbtaylor@gmail.com:
Is your smtpconnectiontimeout setting of 10, too small? I've never changed that setting from whatever it's default is and send 100's of emails a day using similar code.
Fred
On Mon, Sep 25, 2017 at 8:21 AM, Rafael Copquin rafael.copquin@gmail.com wrote:
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/smtpc onnectiontimeout") = 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.
.UpdateENDWITH
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
[excessive quoting removed by server]
When customers of ours get strange connection errors with gmail, they sometimes get an email in their gmail account from Google with a reason. More times they don't get that email.
We now use a third party control for sending emails. It has some decent logging to see what error actually was returned from the server. The price is reasonable. https://chilkatsoft.com/
You might want to try it for the thirty days just to see what the error might be you are getting back. Or this control will work without an issue.
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Rafael Copquin Sent: Monday, September 25, 2017 2:05 PM To: profoxtech@leafe.com Subject: RE: Email with CDO error
I did that and it still does not work. I get the same error message Rafael
Enviado desde Correo para Windows 10
De: Koen Piller Enviado: lunes, 25 de septiembre de 2017 12:33 Para: profoxtech@leafe.com Asunto: Re: Email with CDO error
I've just tested this code and it sent successfully, but not until I turned on the 'less secure apps' setting on the Gmail account.
https://gist.github.com/anonymous/ddb479e315bcc45efb0d4703fc05b836
I used a similar code. Actually what I had to do was put the original code (the one quoted in my first email on this) in a prg, called from the form
I had this code within a loop (that iterated some 400 times) in my send_email form. But it would not work. When I took the code out of the form and placed it into a prg, it worked!
A pseudocode of my form calling the prg is:
select curInvoices
scan all
cTo = alltrim(curInvoices.email) && get the email from each customer
cAttach = alltrim(curInvoices.invoice) && contains path to the pdf and its individual name
do sendemail with cTo,cAttach
endscan
I also put a counter to iterate 10 times, then wait 15 seconds and then pick another ten emails and so on. This is to avoid gmail rejecting a big load of emails sent at once.
Of course I had to turn on the 'less secure apps' setting on the Gmail account first, and then it worked perfectly.
I wonder why it would not work with the cdo code directly on the form. BTW, my client runs this app from a Windows 7 prof computer, for what its worth.
Thank you all for your suggestions
Rafael Copquin
El 26/09/2017 a las 7:54, Alan Bourke escribió:
I've just tested this code and it sent successfully, but not until I turned on the 'less secure apps' setting on the Gmail account.
https://gist.github.com/anonymous/ddb479e315bcc45efb0d4703fc05b836
--- Este correo electrónico ha sido comprobado en busca de virus por AVG. http://www.avg.com
I used a similar code. Actually what I had to do was put the original code (the one quoted in my first email on this) in a prg, called from the form
I had this code within a loop (that iterated some 400 times) in my send_email form. But it would not work. When I took the code out of the form and placed it into a prg, it worked!
A pseudocode of my form calling the prg is:
select curInvoices
scan all
cTo = alltrim(curInvoices.email) && get the email from each customer
cAttach = alltrim(curInvoices.invoice) && contains path to the pdf and its individual name
do sendemail with cTo,cAttach endscan
I also put a counter to iterate 10 times, then wait 15 seconds and then pick another ten emails and so on. This is to avoid gmail rejecting a big load of emails sent at once.
Of course I had to turn on the 'less secure apps' setting on the Gmail account first, and then it worked perfectly.
I wonder why it would not work with the cdo code directly on the form. BTW, my client runs this app from a Windows 7 prof computer, for what its worth.
Thank you all for your suggestions
Rafael Copquin
El 26/09/2017 a las 7:54, Alan Bourke escribió:
I've just tested this code and it sent successfully, but not until I turned on the 'less secure apps' setting on the Gmail account. https://gist.github.com/anonymous/ddb479e315bcc45efb0d4703fc05b836
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Libre de virus. www.avg.com http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---