Solved

Autmatically email all coldfusion errors to system administrator.

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 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

15 Experts available now in Live!

Get 1:1 Help Now