Bryan, I have followed your suggestion. I created a query with a phony
datasource to generate an error and put the <cfmail outside the cfcatch
block. I have tried the following code in my development box and on the
hosting environment and it does not send the email with the error.
Can someone try the following code with your email address and see if an
email is sent.
Scratching my head.
Sebastian
----------------------------
<cftry>
<cfquery name="Test" datasource="X">
Select * from Members
</cfquery>
<cfcatch type="database">
<cfset Detail = CFCATCH.Detail>
</cfcatch>
</cftry>
<cfif IsDefined("Detail")>
<cfmail from="[EMAIL PROTECTED]" to="[EMAIL PROTECTED]" subject="Database Error">
#Detail#
</cfmail>
</cfif>
<cfoutput>#Detail#</cfoutput>
on 5/22/01 3:44 AM, Bryan LaPlante at [EMAIL PROTECTED] wrote:
> Never tried to do that inside of a cfcatch block before but could you just
> populate a variable with the email message and then outside the try block
> check to see if the message is not empty and then send an email if so?
>
> Bryan
>
> ----- Original Message -----
> From: "sebastian palmigiani" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Monday, May 21, 2001 10:39 PM
> Subject: cfcatch and email
>
>
>>
>> I want to send an email with database error info using cftry/cfcatch. But
> it
>> is not working. Am I trying to do something that can't be done within a
>> cfcatch block?
>>
>> Sebastian
>>
>> -------------------------------
>>
>>
>> <cftry>
>>
>> <cfquery name='foo' datasource='foo'>
>>
>> Select * from members
>>
>> </cfquery>
>>
>> <cfcatch type="database">
>>
>> <!--- EMail WebMaster --->
>> <cfmail from="[EMAIL PROTECTED]"
>> type="HTML"
>> to="[EMAIL PROTECTED]"
>> subject="Database Error">
>>
>> Date: #DateFormat(Now(), "MM D, YYY")# #TimeFormat(Now(), "h:mm tt")#<br>
>> Error Type: #CFCATCH.Type#<br>
>> Message: #CFCATCH.Message#<br>
>> Template: #CGI.CF_Template_Path#<br>
>> Referer: #CGI.HTTP_Referer#<br><br>
>> Details:
>> #CFCATCH.Detail#<br><br>
>> </cfmail>
>>
>> <cflocation url="index.cfm?go=Error"> --->
>>
>> </cfcatch>
>>
>> </cftry>
>>
>>
>>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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