5 Replies Latest reply on May 22, 2008 1:31 AM by Hermie3

    Variable in mailto link possible?

    Hermie3
      I was wondering, is it possible to add a RoboHelp variable to a mailto link?

      I'm trying to include the topic title as the subject in a mailto link.

      E.g.
      <a href="mailto:support@company.com?subject=Variable">Feedback</a>

      Thanks for your help.

      Herman
        • 1. Re: Variable in mailto link possible?
          Captiv8r Adobe Community Professional & MVP
          Hi Hermie3

          Yes, this is possible to do. Hop over to my site and download my Tips and Tricks file for RoboHelp. Inside, I've outlined how to accomplish it.

          You may download the file by Clicking here.

          Once you get it (It's a compiled .CHM) crack open the Index and search for E-Mail.

          Best of luck to you! Rick :)
          • 2. Re: Variable in mailto link possible?
            Hermie3 Level 1
            Thanks a lot Rick. It works like a charm.

            Thanks also for all these other tips & tricks.

            Herman
            • 3. Re: Variable in mailto link possible?
              Hermie3 Level 1
              > It works like a charm.

              Except when the document title includes an ampersand (e.g. mailto:John@support.com?subject=Jack&Jill).

              In Outlook 2003, the subject is interrupted after 'Jack' in Jack&Jill'.

              I replaced '&' with &amp and %26, but this doesn't change a thing.

              Any ideas how to escape the ampersand?
              • 4. Re: Variable in mailto link possible?
                Hermie3 Level 1
                Problem solved.

                %26 works, but you have to enter it directly in html view. If you enter it through the script dialog it gets substituted with &amp;.
                • 5. Re: Variable in mailto link possible?
                  Hermie3 Level 1
                  Thanks again Rick for the link to the Tips&Tricks file.

                  BTW, I changed the code from your example a bit. This adjustment replaces ampersands in titles/url so that these are parsed correctly by email client:

                  function mailink()
                  {
                  document.write('<p><A HREF="mailto:support@company.com?Subject=');
                  // var temp = document.title; *//
                  var temp = document.URL;
                  // uncomment the line above and comment the line above it using // to switch to URL. *//
                  temp = temp.replace(/&amp;/g,'%26');
                  temp = temp.replace(/&/g,'%26');
                  document.write(temp);
                  document.write('&body=Please do not alter the Subject line. It is used to help us identify the page you are reporting.">Feedback</A></p>')
                  }