Solved

Autmatically email all coldfusion errors to system administrator.

Posted on 2007-11-27
5
606 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now