Have you tried this?

<cfmail .....>

<cfprocessingdirective suppresswhitespace="Yes">

<CFLOOP INDEX="i" FROM=1 TO=3>
body line #i#
</CFLOOP>

</cfprocessingdirective> 

</cfmail>

______________________
steve oliver
cresco technologies, inc.
http://www.crescotech.com


-----Original Message-----
From: Lawrence B. Afrin, M.D. [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 23, 2002 6:33 PM
To: CF-Talk
Subject: Can anybody confirm this CFMAIL whitespace behavior?


Howdy --

Today I discovered (I think) a CFMAIL behavior I didn't previously know
about and which I can't find documented anywhere.  (Unable to check the
forums, as that system appears to be down for maintenance at the
moment.)

Ordinarily, any line breaks that I put in the message body enclosed
between CFMAIL and /CFMAIL tags are reproduced as I've coded them.  In
other words, this code:

CFMAIL TO=... FROM=... SUBJECT=...
body line 1
body line 2
body line 3
/CFMAIL

gives me an e-mail message whose body looks like this:

body line 1
body line 2
body line 3

But today I discovered that when I have a CFLOOP inside a CFMAIL message
body, the line breaks I specify within the CFLOOP have totally vanished
in the final message body that the CF engine generates.  For example,
this code:

CFMAIL TO=... FROM=... SUBJECT=...
body line A
CFLOOP INDEX="i" FROM=1 TO=3
body line #i#
/CFLOOP
body line B
/CFMAIL

produces this message body:

body line A
body line 1 body line 2 body line 3
body line B

instead of the message body I expect to see, namely:

body line A
body line 1
body line 2
body line 3
body line B

Now, I would expect the former output ("...body line 1 body line 2 body
line 3...") if I coded the CFLOOP like this:

CFLOOP INDEX="i" FROM=1 TO=3 body line #i# /CFLOOP

But, with a line break between the #i# and the /CFLOOP, I'd expect to
see each "body line whatever-number" on a separate line in the e-mail
mesage body.

I did find a work-around, however.  If I put the intra-CFLOOP line
breaks that I want to see in the message body inside of their own
CFIF-/CFIF blocks, *then* they show up in the message body.  For
example, this code:

CFMAIL TO=... FROM=... SUBJECT=...
body line A
CFLOOP INDEX="i" FROM=1 TO=3
body line #i#
CFIF TRUE
/CFIF
/CFLOOP
body line B
/CFMAIL

produces the desired output:

body line A
body line 1
body line 2
body line 3
body line B

(Of course, if I had coded CFIF TRUE /CFIF (all on one line, instead of
a line break between TRUE and /CFIF), then, again, there would be no
line break after each "body line whatever-number".)

FWIW, I should note that both the CFMAIL and CFLOOP statements in the
code in which I discovered this behavior are query-based statements.  I
don't know if I'd see this behavior if I didn't have the QUERY=...
parameter in the CFMAIL and/or CFLOOP.

So, are CF whitespace rules, which ordinarily are suspended in a CFMAIL
body, supposed to take effect again within other CF constructs contained
within a CFMAIL body?  If so, I think it's kind of confusing behavior
(which probably should be added to the documentation).  After all, note
that CFOUTPUT isn't required within CF constructs contained within
CFMAIL bodies in order to get CF to substitute #var# constructs with
their values.  So if CFOUTPUT rules don't come back into effect within
these inner constructs, then why do whitespace rules come back into
effect?

And does the ENABLECFOUTPUTONLY setting affect this behavior I've noted?

-- Larry Afrin
   Medical University of South Carolina
   [EMAIL PROTECTED]



______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to