Q: How can I send email that includes the form data file using the submitForm action?

A: PDF Studio supports using submitForm as a Javascript action to send form data by email. The form data is sent as an attachment. Below is an example showing a button with submitForm action.

1. Create a Push Button

2. Right click on the Button -> Properties -> select Actions

3.  Select Add -> select JavaScript action from “Action” list

4. Copy and paste the following code. This will send the form data as as an fdf file, which is the default format:

var url = "mailto:testemail@qoppa.com?subject=My Subject&body=Here is my form data.";
this.submitForm(url,true);

submitForm2

To send the form data as an xfdf file (xml file) instead of an fdf file, use the code below:

var url = "mailto:testemail@qoppa.com?subject=My Subject&body=Here is my form data.";
this.submitForm({cURL: url, cSubmitAs: "XFDF"})

5. Change email address, subject and body to contain the information you wish to see.

6. Click OK to apply the save the JavaScript action.

When you click on the button, PDF Studio will ask permission and then open the mail application with the subject, body specified above and the form data as an attachment. Make sure your email application has been configured correctly. You can refer to our knowledge base entry to change default email application.