Other PDF Issues

How to Create PDF Buttons That Submit Forms by Email

Adam DavisAdam Davis Nov 3, 2026 868 views

Question details

The user wants to create a PDF form with a button that submits data via email, sets recipient addresses dynamically, and automatically handles file attachments.

How to Create PDF Buttons That Submit Forms by Email
Product
PDF
Device & OS
not provided
Scenario
Designing an interactive PDF form for automated email submission with dynamic recipients and file attachments.
Observed behavior
PDF buttons can successfully use JavaScript to submit forms and set email addresses dynamically, but automatically attaching external files to the outgoing email is heavily restricted by the PDF reader and email client environments.
Before you start

Ensure you are using a comprehensive PDF editor that supports form creation and document-level JavaScript execution. Both the sender and the recipient must have a properly configured default email client for the submission action to work.

Solution 1Recommended

Create an Email Submit Button Using JavaScript

Use button-level JavaScript to dynamically extract an email address from a form field and trigger an email submission.

Using JavaScript within a PDF form allows you to automate workflows, such as dynamically pulling an email address from a user's input field and opening a pre-addressed email draft.

However, due to security constraints enforced by modern PDF readers, you cannot use these scripts to automatically extract external files from a user's computer and attach them to the email.

1
Open the PDF Form

Open your PDF form in a capable PDF editor such as Acrobat or WPS Office.

2
Add a Push Button

Navigate to the Form editing tools and insert a 'Push Button' onto your document page.

3
Configure Button Actions

Double-click the newly added button to open its Properties. Go to the 'Actions' tab, select 'Mouse Up' as the trigger, and choose 'Run a JavaScript' as the action.

4
Insert JavaScript Code

Enter the JavaScript code to define the email recipient based on a form field. For example: var email = this.getField('EmailField').value; app.mailMsg({bUI: true, cTo: email, cSubject: 'Form Submission'});

5
Test the Submission

Save the PDF file, switch to the Hand or Selection tool, and click the button to verify it launches your default email client with the correct recipient address.

Create an Email Submit Button Using JavaScript
Attachment Limitations: You cannot automatically attach arbitrary external files to the email via PDF JavaScript. Only the PDF itself or the extracted form data can be easily sent.
Easily Create PDF Forms

Build Interactive PDF Forms Using WPS Office

WPS Office provides comprehensive PDF editing tools, allowing you to easily insert text fields, checkboxes, and interactive buttons for form submissions without needing complex coding skills.

  1. 1. Open Your PDF Document: Launch WPS Office, go to the 'PDF' tab, and open the document you wish to turn into an interactive form.
  2. 2. Access Form Tools: Navigate to the 'Form' menu on the top ribbon to access the interactive form controls.
  3. 3. Insert a Push Button: Select the 'Push Button' tool and click on the page to draw the button at your desired location.
  4. 4. Configure the Submit Action: Double-click the button to open its properties, go to the actions tab, and set it to submit the form data or run a custom script.
  5. 5. Save and Distribute: Save your document as a standard PDF. It is now ready to be distributed to users for filling and submission.
Easily add interactive form fields like push buttons, text boxes, and dropdowns to your PDFs.Highly compatible with standard Adobe PDF form features, JavaScript, and Microsoft Office document formats.Lightweight alternative for smooth reading and reliable form filling on any device.User-friendly interface to quickly manage document properties and interactive elements.
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't my PDF submit button attach external files automatically?

For security reasons, PDF readers restrict JavaScript from accessing a user's local file system. This prevents malicious scripts from automatically grabbing and emailing private files without the user's explicit consent.

Can I use different buttons for 'Yes' and 'No' responses in my PDF form?

Yes, you can create separate buttons and assign distinct JavaScript actions or form values to each. This allows your form logic to process different responses dynamically before sending the submission.

What happens if the user filling the form doesn't have a default email client set up?

If there is no default desktop email client configured on the user's device, the PDF submit button will fail to generate an outgoing email draft. In such cases, the user must save the filled PDF manually and attach it to an email via their webmail service.