home *** CD-ROM | disk | FTP | other *** search
/ ftp.americansys.com / 2014.06.ftp.americansys.com.tar / ftp.americansys.com / spamcrusherenterprise.exe / web / viewemail.asp < prev    next >
Text File  |  2004-05-28  |  5KB  |  170 lines

  1. <html>
  2.     <head>
  3.         <title>Spam Crusher - View Email</title>
  4.         <meta http-equiv="Content-Language" content="en-us">
  5.         <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
  6.         <meta name="ProgId" content="FrontPage.Editor.Document">
  7.         <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  8.     </head>
  9.     <body>
  10. <!--#include FILE="header.asp"-->
  11. <!--#include FILE="timeout.asp"-->
  12.     
  13.         <p align="center">
  14. <%
  15.     EmailId = Request.QueryString("EmailId")
  16.     RangeLo = Request.QueryString("RangeLo")
  17.     RangeHi = Request.QueryString("RangeHi")
  18.     Response.Write("<a href =""delete.asp?EmailId=" + EmailId + "&RangeLo=" + RangeLo + "&RangeHi=" + RangeHi +"""><img border=""0"" src=""delete.gif""></a>")
  19.     if (Session("UserId")<>"admin") then
  20.         Response.Write("<a href =""salvage.asp?EmailId=" + EmailId + "&RangeLo=" + RangeLo + "&RangeHi=" + RangeHi +"""><img border=""0"" src=""salvage.gif""></a>")    
  21.     End If
  22. %>
  23.         </p>        
  24.             <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" bgColor="navy" border="0">
  25.                 <TR>
  26.                     <TD>
  27.                         <table>
  28.                             <p>
  29. <%
  30.  
  31.     EOLN = chr(13) + chr(10)
  32.     EmailMsg = ""
  33.  
  34.     Set SpamCrusher = Server.CreateObject("SpamCrusherEnterprise.SpamCrusherEnte.1")
  35.     SpamCrusher.SetCurrentUser(Session("UserId"))
  36.  
  37.     Header = SpamCrusher.GetHeaderByMsgId(EmailId)
  38.  
  39.     StartPos=1
  40.     Length = Left(Header, 3)
  41.     MailFrom = Mid(Header, StartPos+3, Length)
  42.     if (Len(MailFrom)>30) then
  43.         MailFrom = Left(MailFrom, 30) + "..."
  44.     End If
  45.                 
  46.     StartPos = Length+4
  47.     Header = Mid(Header, StartPos)
  48.  
  49.     StartPos=1
  50.     Length = Left(Header, 3)
  51.     MailTo = Mid(Header, StartPos+3, Length)
  52.  
  53.     StartPos = Length+4
  54.     Header = Mid(Header, StartPos)
  55.     StartPos=1
  56.     Length = Left(Header, 3)
  57.     Subject = Mid(Header, StartPos+3, Length)
  58.         
  59.     Subject = Trim(Subject)
  60.     if (Length=0) then
  61.         Subject = "(no subject)"
  62.     End If
  63.  
  64.     StartPos = Length+4
  65.     Header = Mid(Header, StartPos)
  66.     StartPos=1
  67.     Length = Left(Header, 3)
  68.     MailID = Mid(Header, StartPos+3, Length)
  69.  
  70.     StartPos = Length+4
  71.     Header = Mid(Header, StartPos)
  72.     StartPos=1
  73.     Length = Left(Header, 3)
  74.     DateTime = Mid(Header, StartPos+3, Length)
  75.  
  76.     Friends = SpamCrusher.GetFriendsList()
  77.     if (InStr(Friends, MailFrom)=0) then
  78.         'show the "add to my friends" button
  79.         Response.Write("<tr><td><p align=""center""><a href =""add2friends.asp?Friend=" + MailFrom + "&EmailId=" + EmailId + "&RangeLo=" + RangeLo + "&RangeHi=" + RangeHi +"""><img border=""0"" src=""add2friends.gif""></a>" + "</p></td></tr>")
  80.     End If
  81.     
  82.     Response.Write("<tr><td><small><font color=""#FFFFFF""><b>From:</b></small></font></td><td><small><font color=""#FFFFFF"">" + MailFrom + "</small></font></td></tr>")
  83.     Response.Write("<tr><td><small><font color=""#FFFFFF""><b>To:</b></small></font></td><td><small><font color=""#FFFFFF"">" + MailTo + "</small></font></td></tr>")
  84.     Response.Write("<tr><td><small><font color=""#FFFFFF""><b>Subject:</b></small></font></td><td><small><font color=""#FFFFFF"">" + Subject + "</small></font></td></tr>")
  85.     Response.Write("<tr><td><small><font color=""#FFFFFF""><b>DateTime:</b></small></font></td><td><small><font color=""#FFFFFF"">" + DateTime + "</small></font></td></tr>")
  86.  
  87. %>
  88.                             </p>
  89.                         </table>
  90.                         </SMALL></FONT>
  91.                     </TD>
  92.                 </TR>
  93.                 <TR>
  94.                     <TD bgColor="white">
  95.                         <%
  96.     EmailMsg = SpamCrusher.GetMsg(EmailId)
  97.     
  98.     EmailMsg = Replace (EmailMsg, "=3D", chr(61))        
  99.     EmailMsg = Replace (EmailMsg, "=A0", chr(160))        
  100.     EmailMsg = Replace (EmailMsg, "=95", chr(149))        
  101.     EmailMsg = Replace (EmailMsg, "=92", chr(146))        
  102.     EmailMsg = Replace (EmailMsg, "=20", chr(32))        
  103.     EmailMsg = Replace (EmailMsg, "=0A", chr(10))        
  104.     EmailMsg = Replace (EmailMsg, "=0D", chr(13))        
  105.     EmailMsg = Replace (EmailMsg, "=09", chr(9))        
  106.     EmailMsg = Replace (EmailMsg, "=" + EOLN, "")        
  107.  
  108.     'now parse out the junk we don't want.  Start by looking to see if the email is HTML or not
  109.     Pos = InStr(EmailMsg, "<body")
  110.     EndPos = InStr(EmailMsg, "</body>")
  111.  
  112.     if (Pos=0) then
  113.         ' <body> was not found so search for <BODY>
  114.         Pos = InStr(EmailMsg, "<BODY")
  115.         EndPos = InStr(EmailMsg, "</BODY>")
  116. '        Response.Write("Searched for BODY<br>")
  117.     End If
  118.     if (Pos=0) then
  119.         ' <BODY> was not found so search for <html>
  120.         Pos = InStr(EmailMsg, "<HTML>")
  121.         EndPos = InStr(EmailMsg, "</HTML>")
  122. '        Response.Write("Searched for HTML<br>")
  123.     End If
  124.     if (Pos=0) then
  125.         ' <html> was not found so search for <HTML>
  126.         Pos = InStr(EmailMsg, "<html>")
  127.         EndPos = InStr(EmailMsg, "</html>")
  128. '        Response.Write("Searched for html<br>")
  129.     End If
  130.  
  131.     if (Pos>0) then
  132. '        Response.Write(CStr(Pos)+"=Pos<br>")
  133. '        Response.Write(CStr(EndPos)+"=EndPos<br>")
  134.         EndPos = EndPos + 7
  135.         
  136.         ' HTML was found so display it as HTML
  137.         Length = EndPos-Pos
  138.         if (Length>1) then
  139.             EmailMsg = Mid(EmailMsg, Pos, Length)    
  140.         Else
  141.             EmailMsg = Mid(EmailMsg, Pos)    
  142.         End IF
  143.         
  144.     Else
  145.         ' HTML was NOT found so parse out the headers and only display the text
  146. '        Response.Write("TEXT ONLY<br>")
  147.         EmailMsg = Replace (EmailMsg, EOLN, "<br>")
  148.         
  149.         'now find the first blank line.  This is the end of the header and the beginning of the message.
  150.         Start = InStr(EmailMsg, "<br><br>")
  151.         if (Start>0) then
  152.             EmailMsg = Mid(EmailMsg, Start)
  153.         End If
  154.     End If
  155.     
  156.     Response.Write(EmailMsg)
  157.     
  158.     SpamCrusher.Logoff()
  159.     Response.Write("")
  160. %>
  161.                     </TD>
  162.                 </TR>
  163.                 <TR>
  164.                     <TD></TD>
  165.                 </TR>
  166.             </TABLE>
  167.         </P>
  168.     </body>
  169. </html>
  170.