Skip to main content
Participating Frequently
August 27, 2023
Question

mailDoc function not attaching PDF(Adobe Acrobat/Javascript)

  • August 27, 2023
  • 3 replies
  • 3091 views

Trying to execute a mailDoc function using a mouseUp action submit button.

I am at the point where it will open my email app with everything(including the email address I've set, subject, body, etc.) but not attach the pdf itself. Here is my code:

app.alert("Survey Submmited", 3);

var cToAddr = "(Insert email here)@outlook.com";  
var cSubLine = "Technical Skills Survey";  
var cBody = "Please find the attached Skill Survey";  
  
this.mailDoc({  
  bUI: true,  
  cTo: cToAddr,  
  cSubject: cSubLine,  
  cMsg: cBody  
});  
 

I also get this error message from the console( GeneralError: Operation failed. Doc.mailDoc:14:AcroForm:submitForm:Annot1:MouseUp:Action1)

This topic has been closed for replies.

3 replies

Participating Frequently
August 31, 2023

Update! So for some reason, when I remove the cTO line in my code, the error is gone and the attachment is actually there. Problem now is I can no longer include the email address. Very weird considering there is no problems adding a subject and body but the email address is a no-go for some reason. 

Participating Frequently
August 31, 2023

If anyone knows why the cTo would cause this or an alternative that will add an email address without cTo. it would be extremely helpful. 

try67
Community Expert
Community Expert
August 31, 2023

Make sure it's cTo and not cTO, as JS is case-sensitive, so the latter is incorrect.

You can specify the target address under cCc, I believe, and it should work just as well.

This is a very odd error, though.

Thom Parker
Community Expert
Community Expert
August 28, 2023

Just ran your code in the console window and it not only gave me the "General Error", but also popped up a dialog indicating that the email "(Insert email here)@outlook.com", was not recognized and asking me to enter a new email. 

 

But if the email is blank, then it works, i.e., a new email dialog is displayed with the attached PDF, and an empty "to" field. 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participating Frequently
August 28, 2023

That email was just a placeholder for my co-worker's email but I tried your suggestion of leaving the email blank and I'm getting the same results unfortunately(email dialog with no attachment and empty to field). But at the very least it seems that my code is correct. I suspect it has something to do with my Acrobat settings or my internal system as I've tried other people's files and they seem to not attach the pdf as well even though these users seem to have no problems doing so on their side. 

Thom Parker
Community Expert
Community Expert
August 28, 2023

That is indeed very odd. You are probably correct that something to do with settings is causing the issue, but I suspect the settings are corrupted in some way, rather than just set the wrong way.

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
Community Expert
Community Expert
August 27, 2023

That's strange. What's the exact version number of the application (You can find it out by going to Help - About Adobe Acrobat)? What's your OS version? What's your default email application?

Participating Frequently
August 27, 2023

Adobe Acrobat Pro version: 2023.003.20284.

My OS is Windows 10.

And my default email application is Outlook although I already tested this on a MacBook with the Mail application and ended up with the same results

try67
Community Expert
Community Expert
August 27, 2023

Can you share the file in question with us?