Solved

Autmatically email all coldfusion errors to system administrator.

Posted on 2007-11-27
5
608 Views
Last Modified: 2013-12-24
Is there a way to have coldfusion MX 7 automatically email the error details of all errors to an email account without haveing to add code to every single page.
0
Comment
Question by:bjv211
  • 3
  • 2
5 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 20361027
Set up an error handler in your Application.cfm/cfc file and use <cfmail...>  to email the error message details to whatever account you want.

Method 1:
Use <cferror type="exception" template="yourErrorHandlerPage.cfm" ..> in your Application.cfm/cfc file. On yourErrorHandlerPage.cfm dislay an error message for the user and use <cfmail> tags to email the error details.

Method 2:
Use the onError method to display an error message for the user and use <cfmail> tags to email the error details.

You can read more about it here:
"Handling Errors"
http://livedocs.adobe.com/coldfusion/7/htmldocs/00001130.htm#1220254
0
 
LVL 1

Author Comment

by:bjv211
ID: 20361555
ok i've added this to my application.cfm
<cferror type="request" template="../../../error.cfm" mailto="serveradmin@company.com" exception="any">

and this to my error.cfm

<cfmail to="#error.MailTo#" from="CF_Server@company.com" subject="#error.DateTime#">
#error.Diagnostics#
#error.HTTPReferer#
</cfmail>

however, the cfmail isn't mailing and it outputs everything within <cfmail> in the body  

I have cfmail tags in many applications on this server, so I know it isn't a mail config issue.

0
 
LVL 52

Expert Comment

by:_agx_
ID: 20367486
You're using a different "type" than in my example.  You can only CFML tags in a type="exception" handler.  They're not allowed for type="request".  

See here for more info
http://livedocs.adobe.com/coldfusion/7/htmldocs/00001138.htm#1106836
0
 
LVL 1

Author Comment

by:bjv211
ID: 20367641
sweet, its working now! thank you.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 20367691
Welcome :)
0

Featured Post

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
URL redirect 4 69
Coldfusion Datefield problem 2 124
ColdFusion Rereplace 3 87
Rebuild awstats from SSH command line on CentOS, from awstats txt files from another server 1 148
This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

735 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