9 Replies Latest reply on Sep 30, 2008 11:16 AM by Bernd Alheit

    Help with app.mailGetAddrs

      Hi, I need some help with this command app.mailGetAddrs

      I have checked the Adobe Javascript Reference book but copying and pasting the example to adobe acrobat pro 8 (to see what it does and customize it) will give an error... well..

      I'd like to know how to open the Outlook Global Address Book (with an specific text such as "choose person 1") and get that value to a variable so that I'll be able to use that variable with command app.mailMsg to send an e-mail message using default e-mail client (example outlook)

      I'd really appreciate your help with a real example so that I can see it and customize it.

      Thanks! :)
        • 1. Re: Help with app.mailGetAddrs
          George_Johnson MVP & Adobe Community Professional
          What error are you getting, exactly? Can you post the exactl code you're using?

          George
          • 2. Re: Help with app.mailGetAddrs
            Level 1
            The sample code I'm using from the Acrobat JavaScript Scripting Reference is:

            -----------------------------
            -----------------------------

            var attempts = 2;
            while (attempts > 0)
            {
            var recipients = app.mailGetAddrs
            ({
            cCaption: "Select Recipients, Please",
            bBcc: false
            })
            if (typeof recipients == "undefined" ) {
            if (--attempts == 1)
            app.alert("You did not choose any recipients,"
            + " try again");
            } else break;
            }
            if (attempts == 0)
            app.alert("Cancelling the mail message");
            else {
            JavaScript statements to send mail
            }

            -------------------------------------
            -------------------------------------

            And the error is: "missing ; before statement 18: line 19"

            But... I only wanted to test this code to see what it does and customize it.

            What I want is...
            1. When I clic on a link, a window is opened asking me to search in the outlook global address book a contact (window should have a text like this "please choose person 1")
            2. do the same for "person 2" (this will be added as CC)
            3. With these two values in 2 variables, use the command app.mailMsg to open the default e-mail client (outlook) and start creating a message. by this time, "to" and "cc" fields must be filled with values got in steps 1 and 2.

            I think that these are the two commands that I should use but... if not, let me know :)

            I tried this one:

            ---------------------------
            ---------------------------

            var a1 = app.mailGetAddrs
            ({
            cCaption: "Select Recipients, Please",
            cTo: true,
            bBcc: false
            })
            app.mailMsg(true, a1 , "", "", "This is the subject", "This is the body of the mail.");

            -----------------------
            -----------------------

            But when I click on the link it simple doesn't do anything.

            hope you can help me :)

            Thanks
            • 3. Re: Help with app.mailGetAddrs
              Patrick Leckey Level 3
              > bBcc: false
              > })

              You need a ; after the ), before the if (or app., since you changed it in your 2nd sample).
              • 4. Re: Help with app.mailGetAddrs
                George_Johnson MVP & Adobe Community Professional
                Where exactly did you place this code? Note that the mailGetAddrs method has security restrictions, so you cannot run the code you posted if it's contained in the document.

                George
                • 5. Re: Help with app.mailGetAddrs
                  Level 1
                  PDL:

                  I have updated the code to:

                  ----------------------------
                  ----------------------------

                  var a1 = app.mailGetAddrs
                  ({
                  cCaption: "Select Recipients, Please",
                  cTo: true,
                  bBcc: false
                  });
                  app.mailMsg(true, a1 , "", "", "This is the subject", "This is the body of the mail.");

                  -----------------------------
                  -----------------------------

                  And it doesn't make any differente, when clicking on the link, it doesn't do any action, no message, no error, no nothing.

                  George Johnson:

                  In a text I draw a square with the Link button and in properties->actions I select to Execute a JavaScript action. In that place is whare I'm writing this code.

                  But... nothing happens

                  By the way, the first code I wrote is an example from the Adobe Javascript Reference book, I didn't write it or modify it. I only wanted to see what it does and if that would help me but it shows an error ("missing ; before statement 18: line 19") hehehe

                  Well.... any idea why that code isn't doing anything? is it wrong? any other suggestion? isn't anything else within the document or adobe acrobat that is blocking javascript?

                  I hope you can help me.

                  Thanks
                  • 6. Re: Help with app.mailGetAddrs
                    Bernd Alheit Adobe Community Professional & MVP
                    Look at the security restrictions of the method.
                    • 7. Re: Help with app.mailGetAddrs
                      Level 1
                      Bernd Alheit:

                      Where can I find them?
                      • 8. Re: Help with app.mailGetAddrs
                        (Aandi_Inston) Level 1
                        >Where can I find them?

                        In the JavaScript API Reference. It is very important to read all of
                        the notes for every method you intend to use: often they put severe
                        limitations on what you might want to do.


                        Aandi Inston
                        • 9. Re: Help with app.mailGetAddrs
                          Bernd Alheit Adobe Community Professional & MVP
                          > Where can I find them?

                          In the Reference or you did you look only for samples.