When we are making a website, we usually have some wrong operation of the visitor or the defect of our website itself, cause a non-existent page to be accessed, there will be 404 error messages, if the enthusiastic visitors may send you an e-mail alert you, most of the time is not the visitors will send us an e-mail. Today to introduce this program is when our site 404 error prompts to automatically send an e-mail to us, the code is as follows:
The following are the referenced contents: <% @language = "VBScript"%> <% Option Explicit%> <% Dim strpage, Strreferer, strmessage Dim OBJSMTP ' Log the offending page Strpage = Request.ServerVariables ("Http_url") ' Log the Referer Strreferer = Request.ServerVariables ("Http_referer") ' Set up ' email component Set objsmtp = Server.CreateObject ("Jmail.message") Objsmtp.from = "You@yourdomain.com" Objsmtp.fromname = "Your Domain" Objsmtp.subject = "404 Error Logged" Objsmtp.addrecipient ("you@yourdomain.com") ' Write the message strmessage = "Requested page:" & strpage & VbCrLf & VbCrLf If strreferer <> "" Then strmessage = strmessage & "Referer:" & Strreferer Else strmessage = strmessage "The Visitor typed" End If Objsmtp.body = strmessage ' Send the message Objsmtp.send ("mail.jzxue.com") ' Tidy up Objsmtp.clearrecipients Objsmtp.close () Set objsmtp = Nothing %> <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "Http://www.w3.org/TR/html4/strict.dtd" > <title>404 Page not found</title> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "> <body> <p> Appropriate message is here. </p> </body> <% @language = "VBScript"%> <% Option Explicit%> <% Dim strpage, Strreferer, strmessage Dim OBJSMTP ' Log the offending page Strpage = Request.ServerVariables ("Http_url") ' Log the Referer Strreferer = Request.ServerVariables ("Http_referer") ' Set up ' email component Set objsmtp = Server.CreateObject ("Jmail.message") Objsmtp.from = "You@yourdomain.com" Objsmtp.fromname = "Your Domain" Objsmtp.subject = "404 Error Logged" Objsmtp.addrecipient ("you@yourdomain.com") ' Write the message strmessage = "Requested page:" & strpage & VbCrLf & VbCrLf If strreferer <> "" Then strmessage = strmessage & "Referer:" & Strreferer Else strmessage = strmessage "The Visitor typed" End If Objsmtp.body = strmessage ' Send the message Objsmtp.send ("mail.jzxue.com") ' Tidy up Objsmtp.clearrecipients Objsmtp.close () Set objsmtp = Nothing %> <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "Http://www.w3.org/TR/html4/strict.dtd" > <title>404 Page not found</title> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "> <body> <p> Appropriate message is here. </p> </body>
|
please contact the site, timely note your name. Contact Email: edu#chinaz.com (change # to @).