Thank you so much for posting this. I modified the code for my purposes.
Someone may find this helpful://Grab the email from the dropdown or
textfield or whatever fieldvar cToAddr =
this.getField("SelectEmailDropDownMenuName").value;// Second, if needed
add the client CC email addressesvar cCCAddr = "name1@email.com;
name2@email.com";// or grab cc dynamically bu uncommenting this
line//var cCCAddr = this.getField("SelectEmailAdressName").value;// Now
get the beneficiary email only if it is fille...