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 Coder
    Join Date
    Oct 2002
    Location
    Ireland
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Adding a JSP variable to a Mailto Tag

    Hi,
    I am trying to add a JSP variable to the body string to be put in an <a href="mailto: ">tag as follows

    <a href="mailto:me@something.com?Subject=i%20thought%20you%20might%20like%20to%20read%20this&Body=<a href="<%=EmailURL%>">click here</a>

    Where <%=EmailURL%>should be the destination of the link which appears in the body of the mail.

    However the link appears in the email but just links to http://<%=EmailURL%>.

    Please help!!!!

    Thanks, Kathryn

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The problem is you have an <a href> inside another <a href> which is incorrect HTML. Try:

    Code:
    <a href="mailto:me@something.com?Subject=I%20thought%20you%20might%20like%20to%20read%20this&Body=<%=EmailURL%>">click here</a>


    P.S. And get rid of the space the forum puts in between the ? and Subject!

    Although if you're using JSP you might want to look at its server-side email capabilities as an alternative to using "mailto".
    Last edited by whammy; 10-19-2002 at 01:06 PM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #3
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Use document.write.
    The variable "where" could be placed in a script in the HEAD section








    <script>
    where="Kathryn@home.co.uk"

    document.write("<a href='mailto:me@something.com?Subject=i%20thought%20you%20might%20like%20to%20read%20this&Body=E-mail me at "+where+"'>click here</a>")
    </script>



  •  

    Posting Permissions

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