Copy link to clipboard
Copied
I have a javascript that works with a cTo and a cCc. however, I want to add a second address to the cCc line. When I do it only sends to the second address listed and not the first. How do I get it to send to all three addresses?
Copy link to clipboard
Copied
Well, there is a problem with the code, but it's not the cc. The comma is missing from the end of "bUI" parameter. This would have been the issue first to be reported in the console window.
I tested this code (fixed the comma) and it works just fine. There is no problem with the cc line.
To verify this, change the bUI parameter to true, so you see the result in the email dialog.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
You can add multiple email addresses, if you separate them using a semi-colon.
Copy link to clipboard
Copied
doesn't work, the Acrobat won't accept the javascript with a semicolon, have to use a comma. Still only gives me the second email listed.
Copy link to clipboard
Copied
Please post your code, I think you are missing something basic.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
var emailSubject = "New Commercial Card Request Form submitted for " + this.getField("COMPANYNAME ").valueAsString + " " + this.getField("DATE").valueAsString;
var emailMsg = "New Commercial Card Request Form submitted for " + this.getField("COMPANYNAME").valueAsString ;
this.mailDoc({
cTo: ("CashManagementProducts@XYC.com"),
cCc: ("dsanders@XYC.com"),
cSubject: (emailSubject),
cMsg: (emailMsg)
})
Copy link to clipboard
Copied
that code is obviously with only one email in the To and the CC lines. Can't add a second one to either and have it work right.
Copy link to clipboard
Copied
In order for us to do debug, you have to post the code that doesn't work 😉
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Hi,
Please refer to page 287 of the JavaScript for Acrobat API Reference:
https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/AcrobatDC_js_api_reference.pdf
Like Thom and Try67 have suggested some basic things were skipped. You need to remove the parenthesis when using the parameters cTo and cCc , you alse need to input all emails within the quotes separated by semicolon.
The this.mailDoc part should look like this:
this.mailDoc({
bUI: false,
cTo: "CashManagementProducts@XYC.com; anotherCCcontact_1@XYC.com",
cCC: "dsanders@XYC.com; anotherCCcontact_2@XYC.com; anotherCCcontact_3@XYC.com",
cSubject: "your subject here",
cMsg: "your message, yari, yara, blassi, blassi, etc."
});
Also NOTE: that bUI part needs to be set. Using the JavaScript for Acrobat API Reference on page 288 see quote
" If false, the cTo parameter is required and all others are optional. "
Copy link to clipboard
Copied
Ok, so I tried (kinda) what you instructed though your suggestion did not include the variable email subject and message. This is the code I entered. When I try to close the javascript box in Acrobat, it highlights the lines with the two email addresses. What am I doing wrong?
this.mailDoc({
bUI: false
cTo: "CashManagementProducts@ABC.com",
cCc: "email1@ABC.com";"email2@ABC.com",
cSubject: var emailSubject = "New Commercial Card Request Form submitted for " + this.getField("COMPANYNAME ").valueAsString + " " + this.getField("DATE").valueAsString;,
cMsg: var emailMsg = "New Commercial Card Request Form submitted for " + this.getField("COMPANYNAME").valueAsString ;
})
Copy link to clipboard
Copied
You didn't actually do what they suggested, and you added new errors into code.
Here's the corrected code. Notice how the "cCc:" parameter is a single string. The ";" is inside the string. Not outside. If it's outside the string then it has special meaning to the JavaScript engine, but inside the string it's part of the grouped addresses. Notice also that I removed the variable declarations. You can't declare varaibles as a object member value.
this.mailDoc({bUI: false
cTo:"CashManagementProducts@ABC.com",
cCc:"email1@ABC.com;email2@ABC.com",
cSubject: "New Commercial Card Request Form submitted for " + this.getField("COMPANYNAME ").valueAsString + " " + this.getField("DATE").valueAsString,
cMsg:"New Commercial Card Request Form submitted for " + this.getField("COMPANYNAME").valueAsString
})
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
it is still not accepting the cCc: line. I did change them back to actual email addresses.
Copy link to clipboard
Copied
Well, there is a problem with the code, but it's not the cc. The comma is missing from the end of "bUI" parameter. This would have been the issue first to be reported in the console window.
I tested this code (fixed the comma) and it works just fine. There is no problem with the cc line.
To verify this, change the bUI parameter to true, so you see the result in the email dialog.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Thanks. I did finally get it to work.
Copy link to clipboard
Copied
You should not put a space after the semi-colons, though.
Copy link to clipboard
Copied
thanks... noted.

