Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFmail links with whitespace

Status
Not open for further replies.

Lotruth

Programmer
May 2, 2001
133
US
I am trying to send an active link to a file in an email like so...

<cfmail blah>

file is here.pdf

</cfmail>

the only part that is active is which of course causes an error. This there a fix for this?

P.S. Sometimes the problem this a very long link with no whitespace that covers 2 lines. Is the fix the same?

Thank you.
 
sounds like you're mail client is trying to do you the favor of createing a link in a text email.

try
Code:
<cfmail bla... type = "html">

<a href = "[URL unfurl="true"]http://123.45.67.89/my[/URL] file is here.pdf">my PDF file</a>
</cfmail>

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-Douglas Adams (1952-2001)
 
If I understand correctly...all you need to do is change the filename to eliminate the spaces. You should never have a filename with a space in it.

Instead of "my file is here.pdf" you could simply add underscores between the words like: "my_file_is_here.pdf"

The browser is seeing the first space after the word "my" as being the end of the URL.

Hope this helped!

Regards,
Randy Sedlacek
 
Use the UrlEncodedFormat() function. It takes a string with spaces(or special characters, or punctuation) and makes it URL friendly. In your case, it will replace all of the spaces with '%20'.



Hope This Helps!

Ecobb
Beer Consumption Analyst

"My work is a game, a very serious game." - M.C. Escher
 
Thanks everybody

Ok, the a href thing did not work because cfmail will not execute the tag, instead it just displays it.

The UrlEncodedFormat() function worked beautifully for the whitespace problem.

Now, the second problem remains unsolved. If I send a link that is long enough to require 2 lines, then the second line becomes inactive and the link crashes. For an extreme example...


<cfmail>

Click the link below.


</cfmail>


P.S.

Right before I decided to send this, I clicked preview post and noticed that the link was active on both lines in the post. So maybe the problem is just by mail client which is Pegasus. I will send a long one to my yahoo account and see what happens, but go ahead and send suggestions if you have any. Thanks everybody.
 
Ok, the a href thing did not work because cfmail will not execute the tag, instead it just displays it.

$10 says you didn't add type = "HTML" in your cfmail tag like i said.

once you do it will process the <a href... > like it's supposed to. second you can put a long link in the tag.

<a href = "real long link here">Click here</a>

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
You're right. Actually, what had happened was... I tried the html thing, but I did not reformat the contents of the email with breaks and such so it all jumbled together and I dismissed the html thing as some kind of crazy concoction that Mr. bombboy dreamed up. So when I went back and added the html distinction plus formatting it worked perfectly even though I expected something crazy to happen, like Justin Timberlake running out of the stands to pull down Paul's pants during the halftime show yesterday.

Thanks you guys. Once again, all of my problems have been solved by the good folks at tek tips.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top