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

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

Contact Us
Site Map



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: 
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: 
Additionally, you can think about using a shorter subfolder and/or ASP page name, e.g.: 
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: 
Maybe you could use shorter variable names in your querystring: 
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.
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: 
For IIS 5+, you can use the subfolder method above, and place a default page to do the redirect -- so your link would become: 
Then, combining that with some of the techniques from above:

www.tinyurl.com and similar services 
About 10 seconds at www.tinyurl.com yielded a much shorter link than any of the above methods: 
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...