Here is the complete script. I updated the tags at the beginning and very end. and the syntax error went away. The script runs, but not successfully. The email and PDF form data never get to the appropriate inbox (or even spam). I installed the script as directed on the webpage:
https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address
ButtonProperties -> Actions -> Mouse Up -> Run a javascript; using the script exactly below. ClientEmail is the name of a field in the PDF form.
Any ideas where I'm going wrong?
<script language="javascript">
<!--
function doc.mailDoc() {
// This is the form return email. It's hardcoded
// so that the form is always returned to the same address.
// Change address on your form to match the code below
var cToAddr = "webmaster@cheyennefieldarchers.com";
// First, get the client CC email address
var cCCAddr = this.getField("ClientEmail").value;
// Now get the beneficiary email only if it is filled out
//var cBenAddr = this.getField("BennyEmail").value;
//if(cBenAddr != "")
//cCCAddr += ";" + cBenAddr;
// Set the subject and body text for the email message
var cSubLine = "CFA Event Registration Form";
//var cSubLine = "CFA Event Registration Form returned from " + this.getField("ClientName").value;
var cBody = "Thank you for submitting your form.\n" + "Save the filled form attachment for your own records"
// Send the entire PDF as a file attachment on an email
this.mailDoc({bUI: true, cTo: cToAddr, cCc: cCCAddr, cSubject: cSubLine, cMsg: cBody});
}
//-->
</script>