Search code examples
coldfusioncoldfusion-9

Sending an email with CFMAIL inside of a CFSCRIPT


I wrote an application at work that uses a few CFC's- I'm having some errors but I want to actually mail the errors out because the application is live and they are happening rarely.

I can't stop what's currently running to troubleshoot.

Does anyone have any experience/can point me towards doing cfmail inside of a cfc/cfscript? More specifically, inside of a try/catch within cfscript.

We're running ColdFusion 9 which doesn't support <cfmail> inside of <cfscript>.


Solution

  • The mail CFC is built in to CF9 and above. You can use it in cfscript and it shouldn't matter where you implement it - within a try/catch block should be fine in onError.

    Adobe has an example of the usage in their documentation for CF9:

    http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSe9cbe5cf462523a0693d5dae123bcd28f6d-7ff9.html