Skip to main content
May 21, 2016
Answered

Mailto; CC, Subject area with textfield

  • May 21, 2016
  • 2 replies
  • 15411 views

Hi Guys,

I really need some expertise. I have developed a PDF Template with a button "SEND", the purpose of this button is to send the entire template (PDF) to a certain email and a certain CC mail. This is no problem to compute in adobe x pro. But, I also want to incorporate subject area in the mail. This subject area must refer to a specific textbox in the template.

Example:

Mailto: "Test@test.com"

Cc: "test2@test.com"

Subject Test9010 (Generate from the entered data in the template).

Does anyone have a suitable solutions? I have almost searched the entire google and forums for solutions.

Thanks in advance,

This topic has been closed for replies.
Correct answer Karl Heinz Kremer

There is no need to rename the variable. "subject" is not a name that is used in the document or event object, so there is no conflict that could potentially cause the problem you are seeing.

You're wrong. There is an internal property of the Document object called "subject" (see p. 266 of the JavaScript for Acrobat API Reference, XI version), and even though it's no longer in use it still exists and should not be overwritten. Also, since it's a read-only property in Reader it might cause the script to fail there entirely, or produce the wrong results.


Good catch. Yes, "subject" should not be used because it interferes with an old property of the 'Doc" object (Acrobat DC SDK Documentation - Doc.subject()​)

Just rename all instances of the variable "subject" to "theSubject" and you should be OK:

  1. var theSubject = this.getField("Text2").value; 
  2.  
  3. this.mailDoc({ 
  4.   bUI: false
  5.   cTo: "test@test.com"
  6.   cCC: "test2@test.com"
  7.   cSubject: theSubject, 
  8.   cMsg: "Number" 
  9. });

2 replies

Participating Frequently
September 24, 2020

Hello - Do you know how to add 2 fields from the form into the subject line?

try67
Community Expert
Community Expert
September 24, 2020

Following the example given above, use something like this:

var theSubject = this.getField("Text2").value + " " + this.getField("Text3").value;

Participating Frequently
September 25, 2020

thank you! I now have the request to add the words   Product Order  before the above code. I tried this but then only the words Product Order show up in the subject line.

 

var theSubject = "Product Order: " + this.getField("Account").value; this.getField("PO").valueAsString this.mailDoc({ bUI: false, cTo: "orders@Company.com", cSubject: theSubject, cMsg: "Please ensure that your account# and PO# are in the subject line." });

try67
Community Expert
Community Expert
May 21, 2016

That requires using a script. See here for more details: https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address

May 21, 2016

I have already tried this link, but I still have problems.

Do you know how to make it?

Karl Heinz  Kremer
Community Expert
Community Expert
May 21, 2016

Please provide the script you've tried to use. What exactly happens? Are you getting errors? You may want to check the JavaScript console (Ctrl-J or Cmd-J) for errors.