Below you find a script example on how to download an email via POP3 SDK (Connector), scan it with Aloaha and display the results. Other popular applications based on the Aloaha POP3 SDK are mail archiver, website ranking tools, ASP breaking news automation, etc.
The POP3 SDK is part of Aloaha SPAM Rejector. Please contact sales if you need the SDK as a stand alone package.
<% @Language = "VBScript" %> <%
on error resume next Response.buffer = false Response.Expires = -1 Server.ScriptTimeout = 60
dim objPOPServer dim amount dim error dim header dim blnSuccess dim email dim scanresult dim aloahahtml dim htmlbody dim cdo dim nuser dim npass dim nid dim nserver dim defuser dim i dim pop error = 0 defuser = 1 err.clear
nserver = Request.QueryString("NSERVER") if nserver = "" then nserver = Request.QueryString("nserver")
nuser = Request.QueryString("NUSER") if nuser = "" then nuser = Request.QueryString("nuser")
npass = Request.QueryString("NPASS") if npass = "" then npass = Request.QueryString("npass")
nid = Request.QueryString("NID") if nid = "" then nid = Request.QueryString("nid")
nport= Request.QueryString("NPORT") if nport = "" then nport = Request.QueryString("nport")
if nserver<>"" and nuser<>"" and npass<>"" then defuser = 0
err.clear Set objPOPServer = CreateObject("pop3news.popnews") set aloahahtml = CreateObject("aloaha.html") Set pop=CreateObject("module.wrapper") if err.number=0 then if nport = "" then objPOPServer.remoteport = "110" else objPOPServer.remoteport = nport end if if defuser = 1 then objPOPServer.remotehost = "aloaha.com" objPOPServer.username = "web31p8" objPOPServer.password = "testing" else objPOPServer.remotehost = nserver objPOPServer.username = nuser objPOPServer.password = npass end if If objPOPServer.autoconnect = True Then amount = CStr(objPOPServer.getammount) if nid<>"" then if cint(nid)>0 then if cint(nid)<cint(amount)+1 then amount=cstr(nid) defuser = 0 end if end if end if if cint(amount)>0 then header = CStr(objPOPServer.getheader(CStr(amount))) email = CStr(objPOPServer.getmail(CStr(amount))) set cdo = objPOPServer.get_cdo(CStr(amount)) if cdo.htmlbody<>"" then htmlbody = aloahahtml.html2txt(cdo.htmlbody) else htmlbody = cdo.textbody end if if cint(amount)>1 and defuser = 1 then for i = 1 to cint(amount)-1 call objPOPServer.deletemail(cstr(i)) next end if end if blnSuccess = objPOPServer.close_and_quit Else error = 1 End If else error = 1 end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Aloaha SPAM Engine Demonstration</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head>
<body> <% if defuser = 1 then response.Write "<p>You could send an email to <a href='mailto:testing@aloaha.com'>testing@aloaha.com</a>" response.Write "and would see the results of the Aloaha SPAM Engine below. Please note that" response.Write "only the last one Message will kept in the Mailbox. The Rest will be deleted" response.Write "automatically.</p>" response.Write "<p>If you want to create your own ASP Script please have a look at <a href='http://www.aloaha.com/api/popdemo.html' target='_blank'>http://www.aloaha.com/api/popdemo.html</a><br>" response.write "<br>This script supports also the paramenter nhost, nport, nuser, npass and nid<br>" response.write "you could add for example ?nhost=aloaha.com&nserver=web31p8&npass=testing&nport=110&nid=1<br>" response.Write "<br></p>" response.Write "<hr><br>" end if %>
<form action="" method="get"> <% if defuser = 1 then response.Write "<label>testing@aloaha.com has " response.Write(amount) response.Write " mail(s) in his mailbox. I will display the newest one and delete the others.</label><br>" else end if %> Aloaha would have classified this email as:</label> <em><strong><label>
<%
scanresult=cstr(pop.check_mail(cstr(email), Nothing, "pop3")) if scanresult="" then scanresult="neutral" response.Write(scanresult)
%>
</label></strong></em><br><br> <label>From: <% response.Write(cdo.From) %></label><br> <label>To: <% response.Write(cdo.To) %></label><br> <label>Subject: <% response.Write(cdo.Subject) %></label><br><br>
<label>Textbody:</label><br> <textarea name="textarea" cols="100" rows="20"><% response.Write(cdo.textbody) %></textarea> <br> <br> <label>Htmlbody:</label><br> <textarea name="textarea2" cols="100" rows="10"><% response.Write(htmlbody) %></textarea> <br> <br> <label>Source:</label><br> <textarea name="textarea3" cols="100" rows="10"><% response.Write(email) %></textarea> <br> <br> </form> <br><hr><br> <%
response.Write("Subject: "&cdo.Subject&"<br><br>") if cdo.htmlbody<>"" then response.Write(cdo.htmlbody) else response.Write(replace(cdo.textbody,vbcrlf,"<br>")) end if
set aloahahtml = Nothing Set objPOPServer = Nothing Set pop = Nothing %> </body> </html>