ASP to implement a Non-existent Web page to automatically send mail

Source: Internet
Author: User
Tags end implement log mail servervariables tidy domain

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 @).



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.