Mail Function & HTTP Errors

    Date: 07/25/06 (PHP Community)    Keywords: php, web

    I've discovered two things about using the PHP mail function on a page where there's an HTTP Error. First, I discovered that it's not allowed. By this I mean, the mail function just refuses to work when I put it on my error handling page (the objective here is for me, the webmaster, to get an email when somebody encountered an HTTP error). Why the mail function is disabled when there's an error, I haven't the slightest clue. There's nothing about it on php.net either.

    Secondly, and more importantly, I discovered that there's a quick and easy way to overcome this quirk: simply place the mail code in another file and then include that file on your error-handling page. Works like a charm, and now I know when people are having problems with my site. For example, I discovered that bots were searching for (a non-existent) robots.txt and getting 404'd, potentially hurting my visibility to search engines, a problem I was able to quickly correct.

    (Originally posted here.)

    Source: http://community.livejournal.com/php/475121.html

« why isn't this unsetting? || Points and coordinates and... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home