4 Replies Latest reply on Jun 5, 2011 8:55 AM by gkaiseril

    Help with acrobat javascript

      Hello all

       

      I thought someone here maybe able to help. I am creating an interactive pdf and I want to be able to open a default mail application with a new message and recipient filled in when an email address is clicked.. My javascript is very limited and I can only get it to open my Mail application on my Mac and create a new message with recipient. I don't know how to make it work on mac and pc so that it opens the default mail application. The script I am using at the moment is as follows:

       

      app.mailMsg(true,"a&b.com");

       

      Is anyone able to help me with this?

       

      Many thanks

       

      Flunkeymonkey

        • 1. Re: Help with acrobat javascript
          try67 MVP & Adobe Community Professional

          First of all, a&b.com is not a valid email address. But irregardless, this method should work the same on mac as well as a pc. JavaScript is cross-platform. However, there's a note in the reference file for this method that might be of importance. It says: NOTE:On Windows: The client machine must have its default mail program configured to be MAPI enabled to use this method.

          • 2. Re: Help with acrobat javascript
            gkaiseril MVP & Adobe Community Professional

            Have you read the Acrobat JS API reference abouth this method?

             

            >app.mailMsg(true,"a&b.com");

             

            The call above will open your mail client and insert "a&b.com" in the to box. If you want to use this code, you should include the full recepient's email address like "John.Doe@example.com".

             

            app.mailMsg(true, "John.Doe@example.com", "", "", "Your Subject Goes Here", "Your message goes here.");

             

            or

             

            app.mailMsg({bUI: true,

            cTo: "John.Doe@example.com",

            cSubject: "Your subject goes here",

            cMsg: "Your message goes here."

            });

             

            The example from the Acrobat JS API reference for this method, has the following example:

             

            var cMyMsg = "Below are the current budget figures:\n\n";

            cMyMsg += "Date Compiled: " + this.getField("date").value + "\n";

            cMyMsg += "Current Estimate: " + this.getField("budget").value + "\n";

            app.mailMsg({

            bUI: true,

            cTo: "myBoss@example.com",

            cSubject: "The latest budget figures",

            cMsg: cMyMsg

            } );

            • 3. Re: Help with acrobat javascript GKaiseril
              spencerig

              Hello GKaiseril,

                  Thank you for posting this infomation this is exactly what i was needing!! I was needing a way to send emails with a varaible from a form in the subject and body! Thank you, i spent hours looking!

               

              I am also needing it to attach the whole current pdf document into the email also. is there anyway todo this? I tried to do it as "submiting a form" function but then it would not let me use the java to do the varaibles in the body and subject.

               

              Please help!

               

              Thanks!

              Spencer

              • 4. Re: Help with acrobat javascript GKaiseril
                gkaiseril MVP & Adobe Community Professional

                You need a real client mail program on your computer, like MS Outlook. Then you need the program to support and be set to the MAPI mode. You can not use web based email systems.