How to Route PDF Form Emails to Different Recipients by Location in Acrobat
Question details
The user needs to send a submitted PDF form to dynamically determined email addresses based on a location selected within the form.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form that automatically routes submission emails to specific regional contacts.
- Observed behavior
- The goal is to use JavaScript to capture the selected location and append the corresponding email address to the mailDoc function.
Ensure your PDF form contains a correctly named dropdown or text field for the location, and verify that you have access to edit the form's JavaScript actions.
Use JavaScript to Route Emails Based on Location Field
Use the mailDoc method combined with if/else statements to read the location field and dynamically assign the correct recipient email.
By attaching a custom JavaScript action to your form's submit button, you can evaluate the value of a dropdown list and change the destination email address accordingly. Use semicolons to separate multiple email addresses.
Note the exact name of your location field (e.g., 'My Company Location'). You will need this string to fetch the user's selection in the script.
Right-click your submit button, select 'Properties', navigate to the 'Actions' tab, choose 'Run a JavaScript' from the 'Select Action' dropdown menu, and click 'Add'.
Use 'this.getField("My Company Location").valueAsString;' to get the location. Write if/else statements assigning the matching email to a variable (e.g., if location === "Location One", extra = "person1@example.com"). Finally, use 'this.mailDoc({bUI: true, cTo: "primary@example.com;" + extra, cSubject: "Subject"});' to construct the email.
Save your PDF, select a location from the dropdown, and click the submit button. Ensure your default email client opens with the correct recipient addresses populated.

A Powerful, Free Alternative for Office & PDF Needs
While complex JavaScript form routing might require specialized Adobe tools, WPS Office provides a robust, free alternative for everyday PDF editing, form filling, and document management. Enjoy full compatibility with Microsoft Office and standard PDFs in one lightweight suite.

Frequently Asked Questions
Why is my PDF form not attaching to the email?
This usually happens if the user's device doesn't have a default desktop email client configured (like Outlook or Apple Mail), or if the PDF viewer restricts JavaScript execution for security reasons.
Can I hide the email addresses from the user?
If you set the 'bUI' parameter to false in the mailDoc function, it attempts to send the email silently in the background, though modern security settings in most PDF readers often override this and prompt the user anyway.
How do I separate multiple recipient email addresses in Acrobat JavaScript?
You must use semicolons (;) to separate multiple email addresses in the 'cTo' or 'cCc' properties of the mailDoc object. Do not use commas.
Does this script work on mobile PDF readers?
Most mobile PDF readers do not support advanced Acrobat JavaScript actions like mailDoc. This solution is generally intended for desktop environments using fully featured PDF software.




