PHP Email Script

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

    I'm looking for a PHP script that can be included in a Web
page to send an email when the page is sent.  

    What I want to do with it is put it in my error pages so that
I get an email when that error page is invoked and alerts me as to
which error has occurred.  




Re: PHP Email Script

Quoted text here. Click to load it

I assume you are referring to an HTTP error.
If so, you can grab all the information you need from the available
superglobal arrays, then construct your mail() message accordingly to give
you all the information you need.

I'd recommend against this, however.  You may very well get bombarded with
e-mails for 404 errors brought about because some stupid script kiddie is
crawling around looking for vulnerabilities.

For instance, just checking my error logs, I have dozens of requests for

That's a file in Zoom Photo Gallery (which doesn't even exist). Wannabe
hackers are looking for that file because it is related to a known exploit:

While it might be nice to know someone's trying to hack shit on my site so
I can ban them, the truth is I don't have the time to track BS requests
down and, as long as they're getting the 404 that's all that matters to me.
The e-mail would be more of an annoyance than anything else.

Karl Groves

Re: PHP Email Script

Quoted text here. Click to load it

Indeed, the way to do it is to parse error_log files. Check periodicaly  
for type of errors (I have no interest in 401's & 404's for instance, a  
500 would have my immediate attention), possibly how often they repeat  
etc. (repeated 404's could mean a broken link somewhere for instance).

Rik Wasmus
Posted on Usenet, not any forum you might see this in.
Ask Smart Questions:

Re: PHP Email Script


Quoted text here. Click to load it

    Works fine.  Lasts a long time.  


                    Fred Atkinson

Site Timeline