Other PDF Issues

How to Automatically Email a PDF After Saving: Acrobat JS Guide

Algirdas JasaitisAlgirdas Jasaitis Nov 10, 2026 869 views

Question details

The user wants to execute a JavaScript function to automatically generate an email draft with the PDF attached right after the document is saved.

How to Automatically Email a PDF After Saving
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating a fillable PDF form that needs to be emailed back to an administrator immediately upon saving by the client.
Observed behavior
The mailDoc script works correctly when attached to a button's Mouse Up event, but the user is struggling to bind it to the document save event automatically.
Before you start

Ensure you have a desktop PDF editor that supports advanced JavaScript execution and that your default system email client (like Outlook or Apple Mail) is properly configured.

Solution 1Recommended

Use a Form Submit Button Instead of a Save Event

Due to security restrictions, auto-emailing on save is discouraged. Using a dedicated Submit button is the safest and most reliable method across different PDF readers.

Modern PDF readers restrict scripts from automatically sending emails without user interaction to prevent malicious activity. Additionally, a document save event can trigger multiple times unnecessarily, repeatedly generating email drafts.

Instead of binding the mailDoc function to a document save action, attach it to a clearly labeled 'Submit' button so the client can consciously approve the action.

1
Create a Submit Button

Open your PDF in form editing mode and add a new Button field to the document where users can easily see it.

2
Access Button Properties

Right-click the button, select 'Properties', and navigate to the 'Actions' tab.

3
Add JavaScript Action

Choose 'Mouse Up' as the trigger, select 'Run a JavaScript' from the Select Action dropdown, and click 'Add'.

4
Insert mailDoc Script

Paste your JavaScript code containing the mailDoc function into the editor, click 'OK', and save the PDF. Click the button to test the email generation.

Use a Form Submit Button Instead of a Save Event
Security Prompt: The mailDoc function cannot silently send an email in the background. Users will still need to manually hit 'Send' in their desktop mail client.

Easily Edit, Save, and Email PDFs with WPS Office

While writing custom JavaScript for PDF forms can be complex and restricted by security settings, WPS Office provides built-in, one-click solutions to save and directly share your PDF documents via email without requiring any coding.

  1. 1. Open your PDF in WPS Office: Launch WPS Office and open your fillable PDF form using the WPS PDF tool.
  2. 2. Fill and Save: Complete the form fields as needed and click the 'Save' icon in the quick access toolbar.
  3. 3. Share via Email: Click the 'Share' or 'Email' button on the top toolbar to automatically attach the saved PDF to a new email draft in your default mail application.
One-click PDF sharing via your default email clientComprehensive PDF form filling and editing toolsFully compatible with standard Adobe PDF formatsLightweight application with an intuitive, familiar interface
microsoft office alternative - wps office

Frequently Asked Questions

Why does the mailDoc function not work on some PDF readers?

Many browser-based or mobile PDF readers do not support Adobe JavaScript APIs like mailDoc due to security restrictions or limited feature sets. A full desktop PDF application is usually required to execute these scripts.

Can a PDF send an email completely in the background without opening an email client?

No. For security and privacy reasons, standard PDF JavaScript cannot silently send an email. It will always create a draft in the user's default desktop email client, requiring them to manually click 'Send'.

How do I conditionally send an email based on form checkboxes?

You can write a JavaScript 'for' loop to iterate through the form's checkbox fields. If the script detects a checked box, it can trigger an app.alert asking the user if they want to email the form before executing the mailDoc action.