How to Email a PDF and Attachments Automatically with Acrobat JavaScript
Question details
The user wants to automatically email a completed PDF form and its embedded attachments to an address collected within the form using Acrobat JavaScript.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form that utilizes a custom JavaScript button to submit the completed document and attachments via email.
- Observed behavior
- While the PDF can be sent using this.submitForm or app.mailDoc, silent sending is blocked for security, browser viewers often lack JS support, and automatically attaching embedded files usually requires a server-side workflow.
Ensure you are testing your PDF form in a dedicated desktop application like Adobe Acrobat or Reader, as most built-in browser PDF viewers do not support advanced Acrobat JavaScript actions.
Configure Email Submission via Acrobat JavaScript
Use the this.submitForm or app.mailDoc JavaScript methods assigned to a form button to initiate an email containing the completed PDF.
Acrobat JavaScript allows developers to extract an email address entered into a form field and use it to populate a new email draft with the PDF attached.
Due to security restrictions, client-side JavaScript cannot send emails 'silently.' It will always invoke the user's default email client, requiring them to manually click send. Additionally, client-side scripts generally cannot extract and attach embedded files to the email; this usually requires submitting the entire PDF to a server-side processing script.
Open your PDF in Acrobat, enter Form Editing mode, and ensure you have a text field (e.g., 'UserEmail') to collect the recipient's address.
Add a new Button field to your form. Right-click the button, select 'Properties', and navigate to the 'Actions' tab.
Choose 'Run a JavaScript' from the 'Select Action' dropdown menu and click 'Add'.
Enter your script to retrieve the email address and trigger the submission. For example: var email = this.getField('UserEmail').value; this.submitForm({cURL: 'mailto:' + email, cSubmitAs: 'PDF'});
Save the PDF, exit form editing mode, fill in the email field, and click the button to verify it successfully opens your default email client with the PDF attached.

Manage and Share PDF Forms Easily with WPS Office
If configuring complex JavaScript is proving difficult, WPS Office provides built-in, user-friendly tools to fill out PDF forms, add signatures, and email completed documents directly from the interface without writing any code.
- 1. Open the PDF form: Launch WPS Office and open your interactive PDF form using the WPS PDF tool.
- 2. Fill and sign the document: Use the 'Form' tab to quickly fill out text fields, checkboxes, and add your electronic signature if required.
- 3. Share via email: Click the 'Menu' button in the top left, select 'Share', and choose 'Email' to instantly attach your completed PDF to a new draft in your default email client.

Frequently Asked Questions
Can Acrobat JavaScript send an email silently without user interaction?
No. For security and anti-spam reasons, Acrobat prevents client-side JavaScript from sending emails without user knowledge. The action will always open the user's default email client or prompt a security dialog before sending.
Why does my JavaScript submit button not work in a web browser?
Most built-in browser PDF viewers (like those in Chrome or Edge) only offer basic rendering and do not support advanced Acrobat JavaScript execution. Users must download and open the PDF in a dedicated desktop application to use automated scripting features.
How do I include embedded file attachments in the automated email?
Client-side methods like app.mailDoc typically only attach the parent PDF. To include embedded files, you must submit the form data to a server-side script. The server can then parse the PDF, extract the embedded files, and generate an email containing all attachments.




