List in sendmail

List in sendmail

Hello everyone:

I have been using a string variable to "build" the list of email addresses that is used in the To: line of the sendmail task.  See portions of code below:

if ((peemail  !=  "")  &&  (peemail  !=  null))
{
    toEmails = toEmails + "," + peemail;
}

and the To: line:

 sendmail
    (
        To       :  toEmails, input.Email1

I can't take credit for this genius bit of coding as Zoho did it for me to resolve a sendmail issue I was having.  This has been working for a long time and recently the sendmail function stopped working in several different forms.  The response from Zoho is now that lists are not supported in the sendmail function.

Does anyone have a different way of conditionally sending out emails like this?  I know I can use individual sendmails within the If statement but that seems ridiculous and doesn't give visibility to everyone being copied.

Any help is very appreciated.