How to Add an Email Subject to Acrobat JavaScript Form Submissions
Question details
The user wants to automatically include a specific email subject line when submitting a PDF form via Acrobat JavaScript.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Submitting an interactive PDF form via email using JavaScript code.
- Observed behavior
- The PDF form script successfully checks required fields and generates an email, but the resulting email is completely missing the subject line.
Ensure you have permission to edit the JavaScript actions of your PDF form and that your computer's default email client is properly configured to handle mailto requests.
Configure the cSubject Parameter in the mailDoc Method
Modify your existing JavaScript to explicitly pass the subject string to the cSubject parameter.
When using the this.mailDoc method in Acrobat JavaScript, simply defining a subject variable in your script is not enough. You must explicitly assign that variable or text string to the cSubject parameter within the method call to ensure the generated email contains a subject line.
Open your PDF form in Adobe Acrobat, enter Form Editing mode, and locate the button or trigger used for form submission. Right-click the button and select 'Properties'.
Navigate to the 'Actions' tab. Select 'Run a JavaScript' from the list of actions, and click the 'Edit' button to open the JavaScript editor window.
Locate your this.mailDoc function in the script. Add or update the cSubject parameter inside the method's curly braces. For example: this.mailDoc({cTo: "example@domain.com", cSubject: "Consultancy Request Form"});.
Click 'OK' to save the script, close the properties window, and exit form editing mode. Click the submit button to verify that your email client opens with the correct subject line pre-filled.

Easily Manage and Share PDF Forms with WPS Office
Avoid complex JavaScript configurations for simple tasks. With WPS PDF, you can easily create, fill out, and share interactive PDF forms directly with colleagues or clients, streamlining your document workflow.
- 1. Open Your PDF Form: Launch WPS Office and open your interactive PDF form document.
- 2. Fill the Required Fields: Use the built-in form filling tools to input your data safely and efficiently.
- 3. Share via Native Email Integration: Click the 'Share' or 'Email' button on the top toolbar to automatically attach the PDF to your default email client, allowing you to quickly type a subject and send.

Frequently Asked Questions
Why is my Acrobat JavaScript email missing the subject line?
This typically happens if the subject text or variable is not explicitly mapped to the cSubject parameter inside the this.mailDoc method. Simply defining a variable in the script does not automatically apply it to the email output.
How can I add a dynamic subject line based on a form field?
You can retrieve a field value using this.getField('YourFieldName').value and assign it to a variable. Then, pass that variable to the cSubject parameter in your mailDoc function to make the subject dynamic.
Can I test PDF JavaScript form submissions without sending an email?
Yes. You can use the JavaScript console in Acrobat (using console.println) to print out your variables and verify that your subject string is formatted correctly before it triggers the mailDoc method.




