macromedia.coldfusion.cfml_general_discussion
[Top] [All Lists]

Re: CFMAIL test mode?

Subject: Re: CFMAIL test mode?
From: Ian Skinner
Date: Tue, 09 Dec 2008 10:27:02 -0800
Newsgroups: macromedia.coldfusion.cfml_general_discussion


paulferree wrote:
Why is this code not working...it's still crashing and giving me a CF error:


Because you have a syntax error. Syntax errors are found at time of compilation. <try><catch> blocks can only handle errors during execution after the code has been compiled.

This more legitimate code example should show the behavior you desire.

  <cftry>
        <cfset bademail = "">
<cfmail to="#bademail#" from="noreply@xxxxxxxxxxxxxx" failto="paulferree@xxxxxxxxx"
subject="Test email" >
        This is a test
        </cfmail>

 <cfcatch type="any">
 An error has occurred.<br>
        <cfdump var="#cfcatch#">
 </cfcatch>

 </cftry>

<Prev in Thread] Current Thread [Next in Thread>