<!--- generic server wide error reporting --->
<!--- slightly modified for documentation, untested --->

<cfoutput>

  <!--- remove this if you want to show just an error, and none of the content generated before the error -->
  #Error.GeneratedContent#
  
  <!--- show errors and stop when debugging/developing via localhost --->
  <!--- you can modify this to test cgi.remote_addr for your workstation(s) or similar --->
  <cfif cgi.host contains 'localhost'>
    <div style="border:1px dashed red;background-color:black;color:white;padding:8px;">
      #Error.Diagnostics#
    </div>
    <cfabort>
  </cfif>
  
  <!--- else do end-user error processing --->
  An error has occurred : #cgi.remote_addr#<br>
  Email has been sent to an administrator with the details of the error.<br>
  Feel free to contact an administrator with any further questions/comments/suggestions.

</cfoutput>

<cfmail from=coldfusion@example.com to=you@example.com subject="Error : #error.remoteaddress#" type=html>

  <cfset theURL = "http://#cgi.host##cgi.script_name#?#cgi.query_string#">
  
  <hr>
  <a href="#theURL#">#theURL#</a>
  <hr>
  #Error.Diagnostics#
  <hr>
  
  <table>
    <tr>
      <td>Error.DateTime</td>
      <td>#Error.DateTime#</td>
    </tr>
    <tr>
      <td>Error.Browser</td>
      <td>#Error.Browser#</td>
    </tr>
    <tr>
      <td>Error.HTTPReferer</td>
      <td>#Error.HTTPReferer#</td>
    </tr>
    <tr>
      <td>Error.Template</td>
      <td>#Error.Template#</td>
    </tr>
    <tr>
      <td>Error.QueryString</td>
      <td>#Error.QueryString#</td>
    </tr>
  </table>

</cfmail>