100 Email Addresses in SendMail Causing Performance Issues
Application Engine program with SendMail() PeopleCode is taking too long to process if Email list has for example more than 100 addresses to send the email to.
IMPACT
---------------
If it takes this long, program might loop through around 100 times which means programs will take approximately 500 minutes to finish.
The problem caused because to so many email addresses in one Mail_To tag. When email addresses are split up into groups, problem went away.
How to Handle?:
Make sure that in first &MAIL_TO1, you end the 20th email address with comma and NOT semicolon else it will not take parameters from &MAIL_TO2. Please use semicolon to separate multiple email addresses in each Mail_To1, Mail_To2 etc but after the last email address in each line, put comma so that it will consider next Mail_To. In the last i.e. Mail_To5, there is no need to put comma.
For example:
IMPACT
---------------
If it takes this long, program might loop through around 100 times which means programs will take approximately 500 minutes to finish.
The problem caused because to so many email addresses in one Mail_To tag. When email addresses are split up into groups, problem went away.
How to Handle?:
Split the email addresses in multiple MAIL_TO tags to resolve performance issue. For example, if email is intended to be sent to 100 email addresses, use five MAIL_TO tags and include 20 email addresses in each tag.
Example:
Example:
&MAIL_TO1 = " "
&MAIL_TO2 = ""
Make sure that in first &MAIL_TO1, you end the 20th email address with comma and NOT semicolon else it will not take parameters from &MAIL_TO2. Please use semicolon to separate multiple email addresses in each Mail_To1, Mail_To2 etc but after the last email address in each line, put comma so that it will consider next Mail_To. In the last i.e. Mail_To5, there is no need to put comma.
For example:
&MAIL_TO1 = "abc@abc.com;abc@abc.com,";
&MAIL_TO2 = "abc@abc.com;abc@abc.com,";
&MAIL_TO3 = "abc@abc.com;abc@abc.com,";
&MAIL_TO4 = "abc@abc.com;abc@abc.com,";
&MAIL_TO5 = "abc@abc.com;abc@abc.com";
&RET = SendMail(0, &MAIL_TO1 | &MAIL_TO2 | &MAIL_TO3 | &MAIL_TO4 | &MAIL_TO5, "", "", "test", "test mail");
Comments
Post a Comment