• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

CDONTS & DHCP发E-mail例子

发布: 2007-6-30 18:56 | 作者: admin | 来源: | 查看: 18次 | 进入软件测试论坛讨论

领测软件测试网 CDONTS & DHCP发E-mail例子

I have developed code using ASP and CDONTS which will send an email to the person requesting the information.

The Site Visitor @#s DHCP IP
Date/Time
The Region From Where The Visitor Has Made a Hit like India, US etc
Which browser is being used
******************************
<%
@#code by Manikantan
@#Web Developer
@#3rd Agenda
@#Nungambakkam
@#Chennai
@#India

Dim RIPAddress
Dim UAgent
Dim strgetTime
RIPAddress = Request.ServerVariables("REMOTE_ADDR")
reg=split(RIPaddress,".")
@#check for American regions
@# Increase The Numbers into Subdomains to Find The Exact Location
if cint(reg(0))<=207 and cint(reg(0))>=204 then
region="North America or South America or Caribbean or Saharan Africa"
end if
if reg(0)="196" or reg(0)="198" or reg(0)="199" or reg(0)="200" or reg(0)="216" or reg(0)="208" or reg(0)="209" then
region="American regions Inclucding Caniberra and Saharian region"
end if
@#Check for Asian Regions
@#Increase the Check for Accuracy
if reg(0)="202" or reg(0)="203" or reg(0)="210" or reg(0)="211" or reg(0)="169" or reg(0)="61" or reg(0)="24" then
region="Asian pacific region like India,Afghan"
end if
if region <>"Asian pacific region like India,Afghan" then
if region<>"American regions Inclucding Caniberra and Saharian region" thenregion="European Region,North Africa,Russian region"
end if
end if
UAgent = Request.ServerVariables("HTTP_USER_AGENT")
strgetTime = FormatDateTime(Now(),vbLongDate)
@# you need cdonts.dll for this
@# Anyother Mailer like abmailer.dll can be used instead
Dim myMail
Set myMail = Server.CreateObject("CDONTS.NewMail")
myMail.To = "youremail@home.com"
myMail.From = "admin@yourwebsite.com"
myMail.Subject = "You Have a Visitor " & strgettime
Body = "A visitor had visited your site:" & vbCrlf
Body = Body & "His DHCP Ip Was: " & RIPAddress & vbCrlf
Body = Body & "His Agent Was: " & UAgent & vbCrlf
Body = Body & "Date: " & strgetTime & vbCrlf
Body = Body & "The Hit was Approximately From" & vbcrlf
Body = Body & "<b>" & region & "</b>" & vbcrlf
myMail.Body = Body
myMail.Send
Set myMail = nothing
%>

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网