Using Javascript send PDF to a defined email address via dialog
Hi! I have below javascipt for Adobe Acrobat Pro DC. But after I enter the email address in the dialog, I get Missing Arguments error. Appreciate your help!
try {
// Get the current document
var currentDoc = this;
// Prompt the user for recipient's email address
var emailAddress = app.response("Enter recipient's email address:", "Recipient's Email");
if (emailAddress !== null && emailAddress !== "") {
// Get the file path of the current document
var filePath = currentDoc.path;
//Convert filePath to a clickable path
var link = "<a href=\"file:///" + filePath + "\">" + filePath + "</a>";
// Create an email data object with user input and default values
var emailData = {
cTo: emailAddress,
cSubject: "For Your Review and Signature",
cMsg: "Please review and sign the documents located at:\n" +link,
cCc: "", // Add CC recipients if needed
cBcc: "", // Add BCC recipients if needed
oAttachments: [currentDoc.path]
};
// Send the email using AcroSendMail:SendMail action
app.mailMsg(emailData);
}
} catch (e) {
app.alert("Error occurred: " + e.message, 0);
}
