Skip to main content
Participating Frequently
October 25, 2016
Frage

Custom Content in Subject of mailto:

  • October 25, 2016
  • 1 Antwort
  • 17877 Ansichten

I've created a customer form using Adobe Acrobat XI Pro and want to have a field within the form display as part of the text in the Subject line of submitted forms. How do I customize the email subject line with content from a specific form field when one hits the form submit button with a mailto: action?

Dieses Thema wurde für Antworten geschlossen.

1 Antwort

Adobe Employee
October 25, 2016

You would do it by embedding JavaScript in the Submit button.  It might looks something like this:

//Example JavaScript Submit Button

this.mailDoc({

bUI: false,

cTo: "anonymous@audioimagesinternational.com",

cSubject: "Review”,

cMsg: "Please review this document and return. Thank you.”

});

//End Example

In the "cTo:" line you can put the email address that you want, in the "cSubject:" line you can put your custom Subject line and in the "cMsg:" you can put a custom message.

novicenikki
Participant
January 27, 2017

Hello. I have the same question, but I don't see that it has been answered. I have created a Submit Button and have figured out how to get it to email. Now, I would like the subject line of the email to auto populate with a form field. I've provided a few screenshots here if that helps. Any assistance would be great!

try67
Community Expert
Community Expert
November 3, 2021

Hello,

I have changed my submit button to have the the java code:

this.mailDoc({cTo: "(Email Address)", cSubject: this.getField("(Text Field)").valueAsString});

which works perfectly! Only issue I have now is that previously I had some required text fields , the new code does not take these into consideration. What is the best method/ java code to keep them as required?

Thanks


You will need to either perform this validation yourself (I've posted code here that does that, search for "validateRequiredFields"), or use the submitForm command instead of mailDoc, which does it for you. Note that submitForm takes different kinds of input parameters, though.