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
%>
