Forum Discussion

mustafayol's avatar
3 years ago

Sending emails to multiple receipents with built-in SendMail function



I am using testcomplete's built-in SendMail function to send emails via the scripts.

SendMail(ToAddressFromHostFromNameFromAddressSubjectBodyFileName1, FileName2..FileNameN);

The problem is when I write more than one email to ToAddress section it fails.


According to documentation; "You can specify several addresses separated by commas or semicolons."

I tried to write recipient's emails by using separation methods as "," or ";" or "\," or "\;",


let ToAddress = " ," ;

let ToAddress = ""+ "," +"" ;

let ToAddress = ""+ ";" +"" ;

let ToAddress = " ;" ;


When I send an email to one recipient it works.

function send_Mail() {

SendMail(" ", "", "FromSenderTester", "", "Subject test email", "Body Test email")


But when I try to send it to more than one recipient it fails. 
Not Work!

function send_Mail() {

SendMail(" ,", "", "FromSenderTester", "", "Subject test email", "Body Test email")



2 Replies

  • you will need to make an array of the recipients list, and loop over that list sending the emails to each recipient one by one using the same function.

    • mustafayol's avatar

      Hi Justin,


      Thanks for the reply. In fact, that's what I already do. But according to documentation, sending to multiple emails by separating commas or semi-columns should also be possible.


      let receipents = ["", "", ""];


      function sendMultiple(item) {SendMail(item, "", "FromSenderTester", "", "Subject test email", "Body Test email")};



      Best regards