Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Macintosh Trouble with Subject Line in Mailto

    Hello-

    The following is the script I'm using in my web page for people to contact me.

    ....Please Contact:
    Code:
    <SCRIPT type="text/javascript" LANGUAGE="JavaScript">
    var anchortext = “Bob”;
    var mailpart1 = “synapsez51”;
    var mailpart2 = “yahoo.com”;
    var subject = ‘Bitterroot Valley/Real Estate/Inquiry’;
    //var body = 'Set body of email';    // could add a set BODY like this (comment out if not needed)
    var str = "<a href='" + "mail" + "to:";
    str += mailpart1 + "@" + mailpart2;
    str += "?subject="+subject;
    //str += "&body="+body;  // also comment out this line if not needed
    str += "'>" + anchortext + "</a>";
    document.write(str);
    //--> 
    </script>

    It works fine but the subject line in the email shows this: Bitterroot%20Valley/Real%20Estate/Inquiry

    Subject line should read: Bitterroot Valley/Real Estate/Inquiry


    Could someone show me how to fix this so the subject line reads correctly? I spent allot of time reviewing "mailto's" here but nothing I saw addressed this issue, only other forms of the mailto which made it all more confusing.

    Thanks, Robes

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,298
    Thanks
    203
    Thanked 2,561 Times in 2,539 Posts
    It does not work fine. You have several syntax errors which prevent the script from executing. You have used 'literary' quotes as generated by MSWord and not the proper plain ASCII ones. There are also some strange non-printing characters in your code, again probably inserted by MSWord. All code must be generated using a plain text editor.

    This now works:-

    Code:
    <p>PLEASE CONTACT:- 
    <SCRIPT type="text/javascript">
    var anchortext = "Bob";
    var mailpart1 = "synapsez51";
    var mailpart2 = "yahoo.com";
    var subject = "Bitterroot Valley/Real Estate/Inquiry";
    //var body = 'Set body of email';    // could add a set BODY like this (comment out if not needed)
    var str = "<a href='" + "mail" + "to:";
    str += mailpart1 + "@" + mailpart2;
    str += "?subject="+subject;
    //str += "&body="+body;  // also comment out this line if not needed
    str += "'>" + anchortext + "</a>";
    document.write(str);
    </script>
    </p>

    You may care to have a look at https://www.campaignmonitor.com/blog...-contact-form/



    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
    Last edited by Philip M; 08-06-2014 at 09:26 AM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • Users who have thanked Philip M for this post:

    Robes (08-06-2014)

  • #3
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank You very much Philip! and for the link. You are my supreme master...coder, that is-


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •