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 ---