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!

Formatting e-mail in CF 1

Status
Not open for further replies.

PromiseKPR

IS-IT--Management
Apr 6, 2001
2
US
When using <CFMAIL>, is there a way to format the output so that it doesn't look all jumbled?

How it is now:
--------------

Name: George Smith
Address: 123 Smiley Way


How I want it to be:
--------------------

Name: George Smith
Address: 123 Smiley Way
 

You can use HTML formatting if you want.
Just set Type=&quot;html&quot;.

<CFMAIL to=&quot;Email@email.com&quot;
From=&quot;me@mymail.com&quot;
Type=&quot;HTML&quot;
Subject=&quot;FORMAT IT!&quot;
>
<table>
<tr>
<td>
FORMAT
</td>
<td>
IT!
</td>
</tr>
</table>

</CFMAIL>

IF that is not an option be very carefull of any characters within the <cfmail> tags. Try not to use the tab key.
Hope it works for you

 
I don't every work with html formatted messages and have found that by just spacing things out so the variables are the same distance from the left margin and far enough out produces nice results (at least in my mail client).

I would do something like this:

<cfmail....>
Name: #trim(name)#
Address: #trim(address)#
</cfmail>

The problem you may run into without using html tables is that if your CF editor uses a font where the characters take up different amounts of space, you'll have trouble finding the correct amount of space between descriptions on the left and variables on the right. I forget what they call a font where the characters are all the same size but you can just type 10 &quot;1&quot;s and then type 10 &quot;A&quot;s on the next line. With a fixed width font (correct name perhaps?) the characters will all line up above each other. With a variable width font, one line will end at a different point on the page and the characters won't truely be above each other.

I use Notepad for my coding and it uses a fixed width font (hope that's the right name) so I can easily line these up when doing my <cfmail>s. The other problem is that you can code this correctly but if the recipient's email client uses a variable width font to display your text, it still won't line up.

It's kinda a catch-22, use html formatting and get it exact but people with non-html clients won't see it. Use non-html formatting with exact spacing and people with the fancier font's won't see it.

Hope this helps,
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top