Skip to main content
Jamesraywebber85
Participant
January 31, 2018
Answered

Help building javascript to send email as an email not attachement

  • January 31, 2018
  • 1 reply
  • 1904 views

I have this code and not able to make it work   I have a PDF form that I would like to send an email to the email in the field ("Email").  However I do not want it as a PDF attachment, I would like to copy all the info in the PDF and paste into the email just like I see it on my screen.  Here is my code:

var subject1 = "SSC Triage Assistance Request: " + this.getField("CID").value,
var address1 = this.getField("Email").value,
var body1 = this.getField("CID").value,
+            this.getField("Order").value,
+           this.getField("Container").value,
  +          this.getField("Service").value,
   +         this.getField("Date").value,
    +        this.getField("Address").value,
     +       this.getField("Server").value,
      +      this.getField("Supervisor").value,
       +     this.getField("Error").value,
+
"Due to an Order Entry error we are requesting your assistance with completing a manual move as noted below"\n +

+           this.getField("Superuser").value,
  +          this.getField("Triage").value,
   +         this.getField("Name").value,
    +        this.getField("Phone").value,
     +       this.getField("Placement").value,
      +      this.getField("Facing").value,
       +     this.getField("Gated").value,
        +    this.getField("Code").value,
         +   this.getField("Cross1").value,
          +  this.getField("Cross2").value,
        +  this.getField("Special").value;

event.target.submitForm({CURL:"mailto:" +address1 + :?Subject=" + subject1 + "&body=" + body1 +"",cSubmitAS:"PDF",cCharset:"utf-8:});

Any help would be greatly appreciated. Thank you in advance for any suggestions. I am brand new to scripting so dumb down any answers!

This topic has been closed for replies.
Correct answer try67

Then it might not work... Try this, though, as the last line of the code, instead of the submitForm command:

app.launchURL("mailto:" + address1 + "?subject=" + subject1 + "&body=" + body1);

Of course, that will not send the email, just create a Draft that the user has to then manually send.

1 reply

try67
Community Expert
Community Expert
January 31, 2018

Is this file going to be used in Acrobat only, or also in the free Reader? If Acrobat only then you should use the mailMsg method of the app object. If in Reader then it's more complicated. Basically you can only do it using the launchURL method and a "mailto" command, but it has a length limit, so it might not work correctly.

Jamesraywebber85
Participant
January 31, 2018

This PDF will be used on Adobe Acrobat Reader DC

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 31, 2018

Then it might not work... Try this, though, as the last line of the code, instead of the submitForm command:

app.launchURL("mailto:" + address1 + "?subject=" + subject1 + "&body=" + body1);

Of course, that will not send the email, just create a Draft that the user has to then manually send.