Chasing the perfect regex in this circumstance is like trying to herd
cats.  Figure something screwy will always come up and meow at you
from behind, but if you error-proof your app no matter what shows up
you will chug along.

I carved the example below from one of my mail trickler tutorials.  I
personally prefer to store the error record in a single database
record (tied to a EZ-PZ GridMonger grid for administrative display) as
what you see below can get pretty monstrous if there are more than a
few errors.  Doing it that way also lets me cfdump out more scopes for
better diagnosis.  Then I just send a 'hey dummy' email to the admin
telling them to check the error log.

<cfset variables.errArray=ArrayNew(2)>
<cfloop
  query="MailList">
  <cftry>
  <cfmail
     to="#MailList.EmailAddr#"
     from="#MailList.EmailFrom#"
     subject="#MailList.EmailSubject#"
     server="#MailList.EmailServer#"
     type="HTML">
  #MailList.EmailMsg#
  </cfmail>
  <cfcatch type="ANY">
     <cfset arrayAppend(variables.errArray[1],MailList.ID)>
     <cfset arrayAppend(variables.errArray[2],MailList.EmailAddr)>
     <cfsavecontent variable="variables.diaginfo">
     <cfdump var="#cfcatch#" label="Read This You Poor Sap">
     </cfsavecontent>
     <cfset arrayAppend(variables.errArray[3],variables.diaginfo)>
  </cfcatch>
  </cftry>
</cfloop>
<cfmail
  to="[EMAIL PROTECTED]"
  from="[EMAIL PROTECTED]"
  subject="OOPS!"
  server="mail.mydomain.com"
  type="HTML">
<cfdump var="#variables.errArray#" label="Error List">
</cfmail>



On 10/9/07, Rick Root <[EMAIL PROTECTED]> wrote:
> On 10/9/07, Russ <[EMAIL PROTECTED]> wrote:
> > Actually, if the email is being sent to an address hosted at the email
> > server through which the email is being sent, and the server replies saying
> > something like 'This email doesn't exist', CF will fail the mail and put it
> > in the undeliverable folder.  I don't believe it will cause an exception
> > (unless maybe the emails are not set to be spooled in the admin?).
>
> that is correct, if spooling is disabled, cfmail will throw an
> exception on delivery failure.  This of course is REALLY REALLYL slow.
>
> --
> Rick Root
> Check out CFMBB, BlogCFM, ImageCFC, ImapCFC, CFFM, and more at
> www.opensourcecf.com
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:290685
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to