Announcement

Collapse
No announcement yet.

Adding Subject to Mailto:

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Adding Subject to Mailto:

    I have cobbled together some code from two different posts in the forum to add an 'Email a Friend' link for all products. The code is:

    <!-- Begin

    var thisloc=location.href + '#NETQUOTEVAR:PRODUCTANCHOR';
    document.write('<b><SPAN class="actxxsmall">Send </SPAN><A HREF=\"mailto:\?body\=Take a look at this page I found at ' + document.title + '. You can see this item by clicking : ' + thisloc + '\" onMouseOver="window.status=\'E-Mail this item to a friend\'; return true" TITLE="Send your friends e-mail about this page"><SPAN class="actxxsmall">this page</SPAN><\/A> <SPAN class="actxxsmall">to a friend</SPAN></b>');
    // End -->

    My question is where do I add the ?subject part so I can give the email a subject rather than just a body?
    Unusual Silver Jewellery
    Giftmill - Unusual Gifts
    Crystal Healing Jewellery
    Steampunk Jewellery

    #2
    It would need to be &subject=<whatever> and could be placed right at the end of the argument string. You should have only one ?variable=value in an URL; subsequent argument pairs need to be &variable=value
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      So does this mean I can't have &body and &subject in the same line?
      Do I need two lines of code?
      Unusual Silver Jewellery
      Giftmill - Unusual Gifts
      Crystal Healing Jewellery
      Steampunk Jewellery

      Comment


        #4
        No it means you either need ?body with &subject

        OR

        ?subject with &body

        and if you want to add any other parameters they must all be &parameter=value pairs.
        Bill
        www.egyptianwonders.co.uk
        Text directoryWorldwide Actinic(TM) shops
        BC Ness Solutions Support services, custom software
        Registered Microsoft™ Partner (ISV)
        VoIP UK: 0131 208 0605
        Located: Alexandria, EGYPT

        Comment


          #5
          This is the modified line but Actinic still throws up errors.

          document.write('<b><SPAN class="actxxsmall">E-Mail </SPAN><A HREF=\"mailto:\?body\=Take a look at this page I found at ' + document.title + '. You can see this item by clicking : ' + thisloc + '\" onMouseOver="window.status=\'E-Mail this item to a friend\'; return true" TITLE="Send your friends e-mail about this page"><SPAN class="actxxsmall">this item</SPAN><\/A> <SPAN class="actxxsmall">to a friend</SPAN></b>'&subject=This is the subject);
          Unusual Silver Jewellery
          Giftmill - Unusual Gifts
          Crystal Healing Jewellery
          Steampunk Jewellery

          Comment


            #6
            The correct format of the code can be seen in the advanced user guide...

            Enter e-mail address to tell a friend
            <input type=text value="" size=40 onchange="
            var thisloc=location.href + '#NETQUOTEVAR:PRODUCTANCHOR';
            if (this.value != '') {
            location.href='mailto:' + this.value +'?subject=Take%20a%20look%20at%20NETQUOTEVAR:PRODUCTNAME&body=I%20saw%20' + thisloc + '%20and%20thought%20you%20would%20be%20interested.'
            }
            ">
            <input type=button value="OK">

            so try ?subject=blah&body=

            Comment


              #7
              Thanks for that Chris - works a treat.

              For anyone else following this thread here is the final code.

              document.write('<b><SPAN class="actxxsmall">E-Mail </SPAN><A HREF=\"mailto:\?subject=Silver Jewellery from Seriously Silver&body\=Take a look at this page I found at ' + document.title + '. You can see this item by clicking : ' + thisloc + '\" onMouseOver="window.status=\'E-Mail this item to a friend\'; return true" TITLE="Send your friends e-mail about this page"><SPAN class="actxxsmall">this item</SPAN><\/A> <SPAN class="actxxsmall">to a friend</SPAN></b>');
              Unusual Silver Jewellery
              Giftmill - Unusual Gifts
              Crystal Healing Jewellery
              Steampunk Jewellery

              Comment

              Working...
              X