I am having a real problem trying to get a URL complete with the full query string to appear in a mailto:

I am able to display the URL sucessfully above the email link, and also in the alt text for the image that is being used in the <a href="mailto:

The URL is in the following format: http://My-Website.com/ProductDetails.asp?SubCatagoryID=476&ProductID=1211&ProductDetailID=117

Here is the code that im trying to use:

<% 
   
    Dim ThisPage
	Thispage = "http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL") & "?" & Request.Querystring
	
%>
<td width="50%" align="right"><% response.write ThisPage %><a href="mailto:?subject=Send to Freind: send to freind &body=Hi, take a look at this item on the xxx xxxx website, '<%= rsDetail.Fields.Item("ProductName").Value %>' : <% response.write ThisPage %>">
<img src="images/email-link.jpg" border="0" alt="<% response.write ThisPage %>"></a>

The URL with full Query String appears fine before the link, and work fine in the alt tag, but the one in the email cuts off half way through and appears like this:

http://My-Website.com/ProductDetails.asp?SubCatagoryID=476

It should look like this:

http://My-Website.com/ProductDetails.asp?SubCatagoryID=476&ProductID=1211&ProductDetailID=117

How can I correct this? Please help im tearing my hair out....
Joe

Recommended Answers

All 3 Replies

this is because a link can only have so many characters in it. You surpassed the amount of room a link allows. I think it is either 100 chars or so. Your best bet is to send the email yourself. Have a user click the link, supply the email address, and then you can send as much information as you wish. That, or set up a special page that parses the link information.

So instead of this:
http;//My-Website.com/ProductDetails.asp?SubCatagoryID=476&
ProductID=1211&ProductDetailID=117
, set up a page that goes to:
http;//my-website.com/?s=476&i=1211&d=117

The reason why you can do just a question mark is if you name the file "default.asp" it will automatically assume the files name is "default" so it does not need a beginning name before the question mark.

Then on this default.asp page, redirect s as the sub category, i as the product id, and d as the product detail.

this is because a link can only have so many characters in it. You surpassed the amount of room a link allows. I think it is either 100 chars or so.

This is statement has no foundation in reality whatsoever. Where were you getting this information?

IE has a 2,083 character limit (http://support.microsoft.com/kb/208427).

FLASH has an internal character limit on certain types of entries to 127 (http://board.flashkit.com/board/showthread.php?t=305263) but that is not even remotely applicable here.

Responding separately to the original poster with the real solution to the problem.

The reason it is getting truncated is that your querystring in the mailto link has not be URLEncoded. It's been a long time since I've done ASP, so I can't tell you the exact syntax off the top of my head. But a quick search on how to urlencode should solve your problem.

There *are* problems with mailto links performing inconsistently, but that has to do with us, as web developers/designers having no idea what kind of mail client/browser relationship a user may have on their system. I still use them when necessary, but I prefer to provide users with an email form wherever possible.

Sorry this post is like 8 months too late, but will hopefully help you in the future.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.