Skip to main content
Participant
September 25, 2020
Question

Is there a way to send form data in the body of an email using javascript ?

  • September 25, 2020
  • 4 replies
  • 1842 views

Hi everyone, 

First of all, sorry for my english. 
So I made a fillable form in acrobat and I wanted to send only the content of  the form via e-mail.
But (using the "submit a form" option) I always end up with a file attached to the mail (fdf, xfdf, etc). That's not what I want 🙂
I just want to send the content of the filled form, is it possible ? Maybe in JS (I'm a complete noob)?

Thanks

This topic has been closed for replies.

4 replies

JR Boulay
Community Expert
Community Expert
September 28, 2020

Concernant la gestion des caractères accentués il faut absolument lire cet article-tuto :

https://www.abracadabrapdf.net/ressources-et-tutos/js-et-formulaires-ressources/pdf-javascript-et-unicode/

Acrobate du PDF, InDesigner et Photoshopographe
Majan5EB6Author
Participant
September 28, 2020

Hello,

And a big thanks/merci to everyone, that's what I did and it kind of work the way I wanted :

 

app.mailMsg({
     bUI: false,
     cTo: "paul@studiofables.com",
     cSubject: "J'ai une question pour RNEST",
     cMsg: "Prénom : " + this.getField("Prenom").value +
                "\nNom : " + this.getField("Nom").value +
                "\nOrganisation : " + this.getField("Org").value +
                "\nE-mail : " + this.getField("Mail").value +
                "\nQuestion : " + this.getField("Question").value
});

try67
Community Expert
Community Expert
September 28, 2020

Keep in mind this will not work if the file is opened in Adobe Reader!

Majan5EB6Author
Participant
September 28, 2020

I know but for some reason and mostly because, as I said, I'm noob, I can't get the app.launchURL to work.
But it's already a huge step for me.

JR Boulay
Community Expert
Community Expert
September 25, 2020

Vous devriez jetez un œil à ce superbe document d'exemple : https://www.abracadabrapdf.net/pdf-de-demo/formulaires/formulaire-de-contact/

Acrobate du PDF, InDesigner et Photoshopographe
Karl Heinz  Kremer
Community Expert
Community Expert
September 25, 2020

Take a look at the Acrobat JavaScript API document: 

 

The doc.mailDoc() method has a way to specify all parts of an email message: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/index.html#t=Acro12_MasterBook%2FJS_API_AcroJS%2FDoc_methods.htm%23TOC_mailDocbc-74&rhtocid=_6_1_8_23_1_73

 

There is no ready made function that would just add the form contents to the body of an email message, but you can assemble that message as a string, and then use that string to populate the body of your email. It's a bit more complex than just calling a function, but it can be done. 

 

try67
Community Expert
Community Expert
September 25, 2020

If they do that it will still email the file, though, which is what they wanted to avoid doing... In order to do that they will have to use app.mailMsg (which only works in Acrobat), or, and this is a bit of a hack, use app.launchURL to open a mailto link with the contents of the message. The latter is limited in the number of characters it can send, though.