Other PDF Issues

Can Acrobat JavaScript mailDoc Send Emails in HTML Format?

Khadija KhanKhadija Khan Nov 5, 2026 869 views

Question details

The user wants to know if it is possible to use a PDF JavaScript mailDoc button to create and send an email with specific HTML formatting instead of standard text.

Can Acrobat JavaScript Send Emails in HTML Format?
Product
PDF/Acrobat
Device & OS
not provided
Scenario
Using a JavaScript mailDoc action triggered by a PDF button to generate an automated email containing document data.
Observed behavior
The generated email is strictly output in plain-text format, and the user cannot apply HTML styling through the mailDoc method parameters.
Before you start

Before attempting to modify your PDF scripts, be aware that client-side JavaScript in PDFs interacts directly with the system's default email client, which enforces strict formatting limitations for security.

Solution 1

Understand the Limitations of Acrobat mailDoc

Recognize that the native mailDoc JavaScript function in PDF specifications only supports plain-text output.

The app.mailMsg() and doc.mailDoc() JavaScript functions in standard PDF readers (including Adobe Acrobat) are designed to pass basic message parameters to the default email application. Due to security restrictions and standardized API guidelines, these native methods strictly output plain-text message bodies.

You cannot inject HTML tags or rich text formatting directly through these native methods. Any HTML tags included in the script will render as visible text rather than stylized code.

1
Review Script Parameters

Open your PDF JavaScript editor and locate the mailDoc function. Check the cMsg parameter where the body text is defined.

2
Remove HTML Tags

Since HTML is not supported, strip out any <b>, <p>, or <br> tags from your script to prevent them from showing up as raw code in the final email.

3
Format with Plain Text

Use standard plain-text formatting techniques, such as using '\n' for line breaks or standard spacing, to organize your email body.

Scripting Limitation: Emails created by a local PDF script will always be plain text. There is no hidden parameter or toggle to enable HTML mode within mailDoc.
Free Microsoft Office alternative

Enhance Your PDF Workflows with WPS Office

While complex automated tasks like server-side HTML email generation require custom scripting, your everyday PDF editing, form filling, and sharing shouldn't be complicated. WPS Office provides a lightweight, comprehensive suite to handle PDFs and document formatting efficiently.

  1. 1. Download WPS Office: Visit the official WPS Office website and click the 'Free Download' button.
  2. 2. Install the Software: Run the downloaded installer and follow the on-screen prompts to set up the suite on your device.
  3. 3. Open Your PDF: Launch WPS PDF (included in the suite) and open your document to easily edit, fill forms, or share via email.
Seamless compatibility with standard PDF features and Microsoft Office formats (Word, Excel, PowerPoint).Built-in PDF editor to easily modify text, images, and fill out interactive forms without scripting.Share documents directly via email or generate secure cloud links right from the application.Free and lightweight software that runs smoothly across Windows, Mac, and Linux environments.
microsoft office alternative - wps office

Frequently Asked Questions

Can I use mailDoc to attach a file to an HTML email?

No. While the mailDoc function can automatically attach the active PDF document to the email, the body of the message will always be generated in plain text due to API restrictions.

Is there any PDF viewer that supports HTML inside mailDoc?

No standard PDF viewer supports HTML formatting through mailDoc. Programs like Adobe Acrobat and WPS PDF strictly adhere to the JavaScript API specification, which forces plain-text generation for security and universal compatibility.

Can I use mailto: HTML tags in PDF links instead of JavaScript?

You can assign a standard hyperlink with a mailto: scheme to a button (e.g., mailto:email@example.com?subject=Test&body=Text). However, much like mailDoc, this relies on the operating system's default mail client and does not support HTML rendering in the body text.

How do I securely send PDF form data via email without a server?

You can use the native 'Submit Form' action directed to a mailto: email address. This prompts the user's email client to send the raw form data (like FDF or XML) as an attachment or plain text, though it still will not format the message in HTML.