Mobile app version of vmapp.org
Login or Join
Tiffany637

: Is it possible to send an automatic email to the webmaster when a visitors hits a 500 error page? Is it possible to send an automatic email that includes details about the requested page to

@Tiffany637

Posted in: #Email #ErrorReporting #HttpCode500

Is it possible to send an automatic email that includes details about the requested page to the webmaster when a visitors hits a 500 internal server error page?

That way the web master could act more quickly to solve the problem. This is a general question so which platform is used is irrelevant.

10.05% popularity Vote Up Vote Down


Login to follow query

More posts by @Tiffany637

5 Comments

Sorted by latest first Latest Oldest Best

 

@Tiffany637

You can add an iframe that loads a php from other server, then your error page will always send mails.

10% popularity Vote Up Vote Down


 

@Goswami781

Yes, send an email for every error. It's also a good idea to send as much info as you can get as part of the email. Think about grabbing:


the contents of the form collection,
all session variables,
the browser user-agent string,
cookie values,
the page URL, including any querystring parameters.


This helps greatly for debugging purposes. It's trivial to get this info in classic ASP and ASP.NET via the Request and Session objects.

Just don't have an error on your custom error page, or you'll freak out the web server.

10% popularity Vote Up Vote Down


 

@Bryan171

Sending a mail with every error, via a custom error page, may not work if the problem is with PHP related: your custom page may not run either so the mail doesn't go out. Also you'll get one email per error which could be a flood.

I'd suggest instead implementing some form of log scanning: have a cron job (or scheduled task under Windows) scan the log files for errors every day or every few hours and send a summary of anything found since the last check to the relevant admin(s). You could also make your log checking script do a few other things like make sure the web server service (and any database services and so forth) is running, if only for paranoia's sake. If nothing else, one email per reporting period can cover other HTTP error codes (401, 404, ...) and other things found in the logs. If you do this, always send the email message even if nothing is wrong: that way you know if your scanning script has failed to run because you stop getting messages (otherwise no message could either mean all is well or the damage report machine is damaged).

10% popularity Vote Up Vote Down


 

@Sherry384

Yes, very possible. Except email, you can also check Web Server log.

I suggest don't send email on every single 500, otherwise if theres a bug, you mailbox will get flooded. Just record the error id, send 1 for the same error on same id.

10% popularity Vote Up Vote Down


 

@Odierno851

Yes, it's possible. You just need to ascertain whether the web server is IIS or Apache and then you can set it to show a custom page (which will contain the code to capture the details you want from the user and e-mail it to you) whenever a 500 error is encountered.

For Apache, for instance, it's really simple. Simply create (or add if one exists) a .htaccess and use the following rule within it to set up your custom error document:

ErrorDocument 500 /error-docs/500.php

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme