Page 1 of 1

CDO COM - slow script execution when sending email to multiple recipients

Posted: 03 Feb 2020, 13:17
by wodzu
Hi all,

I'm using the CDO Com scripting for sending emails using a corresponding SMTP server. Bunch of recipients (ca. 30) are stored in a variable: and then triggered by a standard command:

Code: Select all

pmsg.To := ListOfUsers
Unfortunately, it takes a long time to execute this particular part of the code. I noticed such regularity, that the more recipients the slower the script execution.

Is it a commonly known problem or maybe there is a different way to send emails to multiple recipients?

Re: CDO COM - slow script execution when sending email to multiple recipients

Posted: 03 Feb 2020, 13:48
by flyingDman
How long does it take?
Also you are presumably using (i.e. in quotes)

Re: CDO COM - slow script execution when sending email to multiple recipients

Posted: 03 Feb 2020, 15:30
by wodzu
flyingDman wrote:
03 Feb 2020, 13:48
How long does it take?
Also you are presumably using (i.e. in quotes)
It takes about 3-4 minutes for ca. 30 recipients.

If i set it between quotes I'll become an error message:

0x8004020C - At least one recipient is required, but none were found.

Code: Select all

pmsg.To := """" ListOfUsers """"
@It's funny, because when I set a single recipient between quotes then it works perfectly, but with more recipients it's showing the above mentioned error...

@@It works like by setting the double quotes like that:

Code: Select all

pmsg.To := "". ListOfUsers .""
but it takes the same time to send it to all recipients.

Re: CDO COM - slow script execution when sending email to multiple recipients

Posted: 03 Feb 2020, 16:01
by TLM
wodzu wrote:
03 Feb 2020, 15:30
If i set it between quotes I'll become an error message
If you don't use quotes with the := operator, AHk should throw an error: The leftmost character above is illegal in an expression.

if you need a quoted list:or using the = operator:

Re: CDO COM - slow script execution when sending email to multiple recipients

Posted: 03 Feb 2020, 16:24
by flyingDman
Yes, that seems to be excessively long (although I have never tried 30 addresses). As small email with a small .txt attachment to 2 addresses takes 3 seconds.
I use:

Code: Select all

rec := "[email protected], [email protected]"
;...
pmsg.To := rec