CFMAIL Error Message Truncated

Posted on 2009-05-08
Last Modified: 2013-12-24
I have an error message handler which e-mail's me of errors on the site.  However, I have noticed on the REQUEST errors, some error messages will include a quotation mark in the error message, which leads the CFMAIL tag to assume the quotation mark is actually closing the CFMAIL tag.  How can I 'encapsulate' the error message so the CFMAIL tag does not thing the quotation mark in the error message is the closing quotation mark for the CFMAIL tag.

In the following code, after the referring page line, a quotation mark in the actual error text appears, which is why there is no explanation of what the error is.
Error Template: /portal/portal/directory/processuser.cfm 
Date Time:Mon Apr 13 09:56:36 GMT-07:00 2009 
Users Browser: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1; .NET CLR 3.0.04506.648)
Query String: 
Referring Page:

Open in new window

Question by:perdiemconsulting
LVL 19

Expert Comment

ID: 24338956
can you post some code

Accepted Solution

zacspam earned 125 total points
ID: 24339213
Without really seeing any code, I'd suggest looking into the DE() function.  You can send your cferror.whatever within a DE() function.

Alternatively, I think you can add a mailto="" attribute to the <cferror> tag, but it has been a while since I tried that.

Hope that helps!

From the Adobe website:

Escapes any double-quotation marks in the parameter and wraps the result in double-quotation marks.
Postpones evaluation of a string that is passed as a parameter to the IIf or Evaluate functions.

The following example shows how you can use the DE function and number signs together, and shows how the function works with an IIF function:

<cfset var1=Blue>
<cfset var2=Green>
<cfset myresult=IIf( 1 eq 2, DE(#Var1#), DE(#Var2#))>
The expression is #myresult#

ColdFusion processes this code as follows:

   1. ColdFusion sets the variables var1 and var2 to be the strings Blue and Green.
   2. In the fourth line, ColdFusion evaluates the variables surrounded by number signs first, replacing them with the strings Blue and Green, the values of the variables.
   3. The IIF function evaluates the test expression, determines that it is False, and then evaluates the third parameter.
   4. The third parameter is a DE function, which takes the string Green and surrounds it in quotation marks
   5. The IIF function returns the string "Green", including the quotation marks.
   6. The cfset tag gets the expression result="Green", and sets the value of the myresult variable to the string Green.
   7. ColdFusion evaluates #myresult# in the output text, replaces the variable with its value, the string Green, and displays the result.

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question