//  home   //  advanced search   //  news   //  categories   //  sql build chart   //  downloads   //  statistics
 ASP FAQ 
Home
ASP FAQ Tutorials

   8000XXXX Errors
   Alerts
   ASP.NET 2.0
   Classic ASP 1.0
      COM / ActiveX Components
      Forms
      General Topics
      Date/Time Routines
      Email Scripts & Info
      Files/Directories & FSO
   Databases
   General Concepts
   Search Engine Optimization (SEO)

Contact Us
Site Map

Search

Web
aspfaq.com
tutorials.aspfaq.com
classicasp.aspfaq.com

ASP FAQ Tutorials :: Classic ASP 1.0 :: Email Scripts & Info :: How do I prevent my links from wrapping in an e-mail?


How do I prevent my links from wrapping in an e-mail?

Let's say your URL is: 
 
http://www.wherever.com/myfolder/mypage.asp?id=1&page=2&frank=3&bob=43521
 
In most e-mail readers, this link will be active (clickable) but probably won't work correctly, because the mail program (and/or the mail server) might force the text to wrap to the next line after a certain number of characters (usually 72 or 76). So, what can you do to prevent this from happening? 
 

Make a shorter URL 
 
If your host headers and/or DNS entries are set up correctly, the first thing you can do is remove 4 characters in www. so the link becomes: 
 
http://wherever.com/myfolder/mypage.asp?id=1&page=2&frank=3&bob=43521
 
Additionally, you can think about using a shorter subfolder and/or ASP page name, e.g.: 
 
http://wherever.com/myf/myp.asp?id=1&page=2&frank=3&bob=43521
 
With IIS 5+, you can consider using a subfolder where the page you want to go to is the default page, so that the following would work: 
 
http://wherever.com/myf/?id=1&page=2&frank=3&bob=43521
 
Maybe you could use shorter variable names in your querystring: 
 
http://wherever.com/myf/?i=1&p=2&f=3&b=43521
 
Finally, if it's acceptable, you can use an the IP address, which may or may not shorten the domain name part of the URL. 
 
http://204.3.20.8/myf/?i=1&p=2&f=3&b=43521
 
So that takes it from 73 characters to 42! 
 

Use a shorter "stub" link that redirects 
 
If you can't modify the actual page that handles the incoming traffic, you could build a "stub" file like that redirects: 
 
<% 
    qs = request.servervariables("QUERY_STRING") 
    response.redirect("http://www.wherever.com/myfolder/mypage.asp?" & qs) 
%>
 
For IIS 4+, place the stub file in your root or in a subfolder, so your link would become: 
 
http://wherever.com/stub.asp?id=1&page=2&frank=3&bob=43521 
or 
http://wherever.com/rd/stub.asp?id=1&page=2&frank=3&bob=43521
 
For IIS 5+, you can use the subfolder method above, and place a default page to do the redirect -- so your link would become: 
 
http://wherever.com/rd/?id=1&page=2&frank=3&bob=43521
 
Then, combining that with some of the techniques from above: 
 
http://204.3.20.8/rd/?i=1&p=2&f=3&b=43521
 

www.tinyurl.com and similar services 
 
About 10 seconds at www.tinyurl.com yielded a much shorter link than any of the above methods: 
 
http://tinyurl.com/imh
 
The only concern I have is longer term -- how long will a free service (a) remain free, and/or (b) keep those links around? 
 
You may want to look at sites like www.shorturl.com and www.makeashorterlink.com, which offer similar services - albeit a bit less convenient. The former requires registration by the person creating the link, and the latter shows their page and logo before redirecting the user(s) following the link. 
 

Use HTML format 
 
So what do you do if you can't control the format and location of the pages on the server, and can't use a service like tinyurl.com? If your clients accept it, you can format your e-mail as HTML, so that the link will surely not wrap. So, for example, you could send this content: 
 
<% 
    url = "http://www.wherever.com/myfolder/mypage.asp?id=1&page=2&frank=3&bob=43521" 
    htmlbody = "<html><body>Please <a href='" & url & "'>register</a>.</body></html>" 
 
    set cdoM = CreateObject("CDO.Message")  
    ' ... 
    cdoM.HTMLBody = htmlbody      
    ' ... 
%>
 
For more information on sending HTML mail, see Article #2474

Related Articles

Can I get CDO messages to return a read receipt?
Can I use a remote SMTP server with CDONTS.NewMail?
How do I alter the priority / importance of an e-mail message?
How do I put carriage returns into an e-mail?
How do I send e-mail from ASP?
How do I send e-mail from SQL Server?
How do I send e-mail in HTML format?
How do I send e-mail with CDO?
How do I validate an e-mail address?
Should I use form action=mailto: to mail the results of a form?
Where can I get more details about configuring / using CDO?
Why can't ASP handle 80,000 e-mails?
Why do CDONTS messages end up in the badmail folder?
Why do I get 8000900F errors?
Why do I get 80040108 errors?
Why do I get 8004020A errors?
Why do I get 80090020 errors?
Why do I get C00402CE / C00402C7 errors?
Why does CDO.Message give 800C000D errors?
Why does CDO.Message give me 8004020F errors?
Why does CDO.Message give me 80040213 errors?
Why does CDO.Message give me 80040222 errors?
Why does my CDONTS mail hang out in the queue or pickup folders?
Why is e-mail to certain domains being rejected?

 

 


Created: 5/18/2002 | Last Updated: 3/24/2005 | broken links | helpful | not helpful | statistics
© Copyright 2006, UBR, Inc. All Rights Reserved. (338)

 

Copyright 1999-2006, All rights reserved.
Finding content
Finding content.  An error has occured...