Other PDF Issues

How to Email a PDF and Attachments Automatically with Acrobat JavaScript

Natalie TaylorNatalie Taylor Nov 3, 2026 869 views

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.

How to Email a PDF and Attachments Automatically with 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.
Before you start

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.

Solution 1Recommended

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.

1
Prepare the PDF form

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.

2
Create a submit button

Add a new Button field to your form. Right-click the button, select 'Properties', and navigate to the 'Actions' tab.

3
Add the JavaScript action

Choose 'Run a JavaScript' from the 'Select Action' dropdown menu and click 'Add'.

4
Write the submission script

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'});

5
Test the form

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.

Configure Email Submission via Acrobat JavaScript
Handling Embedded Attachments: To reliably send embedded attachments alongside the main PDF, you will need to change the submission URL from a 'mailto:' link to a web server endpoint (e.g., a PHP or Node.js script) programmed to process and email the complete file package.

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. 1. Open the PDF form: Launch WPS Office and open your interactive PDF form using the WPS PDF tool.
  2. 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. 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.
Easily fill, edit, and sign interactive PDF forms.Send PDFs directly as email attachments using the built-in Share feature.Highly compatible with standard PDF formats and Adobe Acrobat files.A lightweight and fast Office suite available for free.
QA img-9

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.