ASP實現(xiàn)不存在的網(wǎng)頁就自動發(fā)送郵件_ASP教程

      編輯Tag賺U幣
      教程Tag:暫無Tag,歡迎添加,賺取U幣!

      推薦:用ASP編寫更人性化的彈出窗口程序
      ASP實例:用ASP編寫更人性化的彈出窗口程序,來幫我們制作一個不煩人的調(diào)查的方法。 用彈出窗口來顯示調(diào)查表,被認為是達到我們收集訪問用戶信息的最方便快捷的方法。當制作出第一份調(diào)查表后

      我們在制作網(wǎng)站的時候,通常會有當訪客的一些錯誤操作或我們網(wǎng)站本身的缺陷,造成某個不存在的頁面被訪問,這時會出現(xiàn)404錯誤提示信息,如果是熱心的訪客可能會給你發(fā)一封郵件提示你,當時大部分時候是訪客不會給我們發(fā)郵件的。今天給大家介紹的這個程序是當我們的網(wǎng)站出現(xiàn)404錯誤提示時自動發(fā)送一封郵件給我們,代碼如下:

      以下為引用的內(nèi)容:
      <% @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 the 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 the address in"
      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">
      <html lang="en">
      <head>
      <title>404 Page Not Found</title>
      <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
      </head>
      <body>
      <h1>404 Page Not Found Error</h1>
      <p>
      Appropriate message here.
      </p>
      </body>
      </html>
      <% @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 the 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 the address in"
      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">
      <html lang="en">
      <head>
      <title>404 Page Not Found</title>
      <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
      </head>
      <body>
      <h1>404 Page Not Found Error</h1>
      <p>
      Appropriate message here.
      </p>
      </body>
      </html>

      請作者聯(lián)系本站,及時附注您的姓名。聯(lián)系郵箱:mb5u#vip.qq.com(把#改為@)。

      分享:初學(xué)者的ASP教程:常用ASP內(nèi)置函數(shù)
      函數(shù),就是該語言封裝了的一個功能塊,以方便用戶的調(diào)用。比如“now()”在VBScript中就是一個能顯示出當前日期和時間的函數(shù)。至于具體為什么能顯示,則是該語言內(nèi)核所定的,用戶只需

      來源:模板無憂//所屬分類:ASP教程/更新時間:2008-08-22
      相關(guān)ASP教程