Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
3

mailDoc function not attaching PDF(Adobe Acrobat/Javascript)

Community Beginner ,
Aug 27, 2023 Aug 27, 2023

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)

TOPICS
Edit and convert PDFs , General troubleshooting , JavaScript , PDF
2.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 27, 2023 Aug 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 27, 2023 Aug 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 27, 2023 Aug 27, 2023

Can you share the file in question with us?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 27, 2023 Aug 27, 2023

It's for my job so that might go against their company policies. I'll have to consult my manager first which I won't be able to do til Tuesday

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 27, 2023 Aug 27, 2023

All I can share for now is that it's a survey form, using radio buttons for the answers. I checked the security settings but there's nothing enabled so pretty sure that's not the problem. Bizarrely, if you click the email button in the top left bar in Abode Acrobat Pro, that works fine but still need this button i've made to work. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 28, 2023 Aug 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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 28, 2023 Aug 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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 28, 2023 Aug 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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 31, 2023 Aug 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's no problems adding a subject and body but the email address is a no-go for some reason. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 31, 2023 Aug 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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 31, 2023 Aug 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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 31, 2023 Aug 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 01, 2023 Sep 01, 2023

Strangely, getting the same error with the cCc method you suggested. For whatever reason the document doesn't want to accept emails and attachments at the same time. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 01, 2023 Sep 01, 2023

Are you sure the email address you're specifying is a valid one? It should not contain any spaces, or "mailto:" or anything like that.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 01, 2023 Sep 01, 2023
LATEST

It definitely is. I've got another update. It seems using webmail over a local email app works perfectly (email address, subject, body, and attachment). The only problem is that when using a web browser to fill the pdf over an editor, it always goes for the local email client on submission so I still need to figure it why it has an issue with local email clients. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines