How to Automatically Email a Completed PDF Form with Acrobat JavaScript
Question details
The user wants to configure a PDF form to automatically validate required fields and send an email upon completion using Acrobat JavaScript.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form that automatically submits itself or emails the completed data once the user finishes filling it out.
- Observed behavior
- Acrobat's security settings restrict completely automatic, silent email sending from the client side, requiring either a local email client confirmation or a dedicated external web server workflow.
Ensure you have permission to edit the PDF form's fields and a basic understanding of Acrobat JavaScript. Note that modern PDF viewers block completely silent, background email sending to protect against malicious activity.
Use a Document Action Button to Trigger the Default Email Client
Add a custom JavaScript button that validates fields and securely opens the user's local email program with the completed PDF attached.
Because of strict security protocols, client-side JavaScript within a PDF cannot bypass the user's email client to send an email silently. However, you can write a script to check that all required fields are populated before invoking the 'mailDoc' function, which safely hands the document off to the default mail app.
Open your PDF in Acrobat, go to the Tools menu, and select 'Prepare Form'.
Add a new Button field to the document, place it at the end of your form, and label it 'Submit' or 'Email Form'.
Right-click the button, select Properties, and navigate to the Actions tab. Choose 'Mouse Up' as the trigger, select 'Run a JavaScript' as the action, and click Add.
In the JavaScript Editor, enter a script that checks your required fields. If validation passes, include the command: this.mailDoc({cTo: "receiver@example.com", cSubject: "Completed Form"});
Save the PDF, exit form editing mode, fill out the required fields, and click the button to ensure it properly opens your default mail application.

Implement a Server-Side Submission Workflow
Configure the PDF to submit data directly to a web server script, enabling completely unattended email delivery.
Fill, Manage, and Share PDF Forms Easily with WPS Office
If you are struggling with complex Acrobat JavaScript limitations or expensive software subscriptions, WPS Office offers a straightforward, user-friendly PDF solution. You can easily fill out standard PDF forms, sign documents, and share them via email without writing a single line of code.
- 1. Open the Form: Launch WPS Office and open your interactive PDF form.
- 2. Input Your Data: Click on any text field or checkbox to fill out the form using the built-in PDF reader tools.
- 3. Share via Email: Click the 'Share' or 'Menu' button, select the Email option, and WPS will automatically attach the completed document to a new message in your default mail app.

Frequently Asked Questions
Why does Acrobat ask for permission before sending the email via JavaScript?
Adobe enforces strict security protocols on client-side JavaScript. Silently connecting to the internet or sending out emails without user confirmation is blocked to prevent malicious scripts from secretly extracting data from your computer.
Can I force a PDF to send an email without opening Outlook or another email client?
Not directly through local client-side Acrobat JavaScript. To achieve this, you must configure the PDF's 'Submit Form' action to send the data to a web server URL, which can then programmatically send the email in the background.
How do I validate fields before allowing the form to be emailed?
You can write a custom JavaScript loop that checks the value of each required field. If any required field is empty, the script can trigger an app.alert() message notifying the user and then use a 'return' statement to stop the mailDoc function from executing.




