I have found that dumping all of an e-mail message into a variable works
prefect.

<!--- Set constants for Carriage Return, Line Feed and Horizontal Tab
(ASCII) --->
<cfset cr = Chr(10)>
<cfset lf = Chr(13)>
<cfset tab = Chr(11)>
<cfset messageBody = "Dear #form.cust_firstname#:" & cr & lf &
                        "Thank you for your business.  We are reviewing your
order, " &
                        "and you will be notified when it is shipped." & cr
& lf &
                        "Here is what you ordered:" & cr & lf &
                        "ITEM:" & tab & "QTY:" & "PRICE" & cr>
<cfloop query="itemsQry">
    <cfset messageBody = messasgeBody & itemsQry.item & tab &
                                        itemsQry.qty & tab &
                                        itemsQry.price & tab & cr>
</cfloop>
<cfset messageBody = messageBody & lf &
                    "If you have any questions, please e-mail
[EMAIL PROTECTED]" & cr & lf &
                    "Sincerely," & cr &
                    "Customer Service">

<cfmail to="#form.email#" from="[EMAIL PROTECTED]" subject="Order
Confirmation">
#messageBody#
</cfmail>

This makes for a perfectly formatted e-mail everytime.




----- Original Message -----
From: "Darren Daniel" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, July 06, 2001 7:34 AM
Subject: cfmail preformatting


I have a problem formatting the contents within the body of cfmail.
When I try and output data using cfif statements it sometime leaves line
breaks in the outputted email.
Heres the code:

<cfif IsDefined ("form.email")>
  <cfmail to=#Form.email#
        from="me"
        subject="Your order is being processed">Dear #form.name#

Thank you for ordering from Us.
You ordered:
<cfif IsDefined ("form.tshirt") AND form.tshirt IS "9_11wel"><cfif IsDefined
("form.tshirt_amount") AND tshirt_amount IS NOT "0">#tshirt_amount#</cfif>
9-11 year old's Welsh tshirt(s)</cfif>
<cfif IsDefined ("form.cap") AND form.cap IS NOT ""><cfif IsDefined
("form.cap_amount") AND form.cap_amount IS NOT "0">#cap_amount#</cfif>
cap(s)</cfif>
<cfif IsDefined ("form.mug") AND form.mug IS NOT "0">#mug# mug(s)</cfif>
<cfif IsDefined ("form.pen") AND form.pen IS NOT "0">#pen# pen(s)</cfif>
  </cfmail>
</cfif>

So if someone selected just a cap and pen it would output for example:

You ordered:
1 cap(s)

2 pens(s)

There is a blank line between the two orders which I do not want.  (I want
the pen order to be on the next line)
When I use type="html" and format it that way it works fine, but I need to
send the email in plain text format.
Any ideas please?

TIA


Darren Daniel
Producer
------------------------------------------------------------------
United Kingdom
http://www.thoughtbubble.co.uk/
Ph: +44 (0) 20 7387 8890
------------------------------------------------------------------
New Zealand
http://www.thoughtbubble.co.nz/
Ph: +64 (0) 9 419 4235

The information in this email and in any attachments is confidential and
intended solely for the attention and use of the named addressee(s) . Any
views or opinions presented are solely those of the author and do not
necessarily represent those of Thoughtbubble. This information may be
subject to legal, professional or other privilege and further distribution
of it is strictly prohibited without our authority. If you are not the
intended recipient, you are not authorised to disclose, copy, distribute, or
retain this message. Please notify us on +44 (0) 20 7387 8890
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to