What is SpamStats?
Spamstats is a scripted method of tracking spam, emailed viruses, incoming, and outgoing messages. You are only limited on what is collected by the rules you create.
Spamstats.vbs is a Windows Scripting Host (Visual Basic) script that when executed will update a MySQL Database (http://www.mysql.com) . The script is called from Mail Filter Pro v3.0.114b (or higher) which was developed by Server Side Solutions (http://www.sssolutions.net/). Mail Filter Pro is an add-on server extension for Argo Software Design Mail Server Pro (http://www.argosoft.com/). The scripts can also be called from Server Side Solutions eWall programmable gateway.
Requirements:
- Windows Operating System (98, ME, NT, 2000, XP, 2003) with Windows Scripting Host.
- MySQL Database server. (This script was tested on v4.0.14)
Note: This script can be adopted to work other SQL Databases and MS Access.
- Mail Filter Pro v3.0 or higher.
Note: This script is compatible with Server Side Solutions eWall product. eWall will allow you to track even more conditions than Mail Filter, such as connections, invalid sender, invalid domain, attempted relay attempts, and invalid recipients, to mention a few.
Getting Started:
In the accompanying zip file is a SPAMSTATS.SQL. This file is the data structure of the two databases used by this script. Using MySQL Control Center, open the SPAMSTATS.SQL file and execute the SQL command to create the two tables. Next open the CONFIG table and insert 1 record. In the KeyName field enter the name "SpamLastUpdated".
Next you need to create some rules from within Mail Filter Pro. Open Mail Filter Pro, click on the filters tab and click new. The first rule is to count the inbound messages. The rule reads:
if message is incoming
then run cscript.exe.
In the executable application box, type the path to cscript.exe. In the command line, enter the path to SPAMSTATS.VBS. For Windows 2000 Server, the default path is C:\WINNT\SYSTEM32\CSCRIPT.EXE. The //T:120 is the Script Time Out value. I have mine set for 120 seconds. You also need to pass the name of the filter. Since this filter is going to count just inbound messages, I named it " Incoming Messages". Notice I placed a space for Incoming. This is so when it is displayed on my web page, and sorted alphabetically, Incoming will always be the first item in the list.

Next you need to create a few more rules. I also use Server Side Solutions Paranoid spam detector, so the next rule shows adding a rule for that. The rule reads:
if message has spam probability more than 50% then run cscript.exe
and add [Paranoid{ X-SPAM-PROB} To: {X-TO} From: {X-FROM} to the subject
and forward a copy to a specific email address
and delete the message
and stop processing other filters.

As mentioned in the previous steps,you need to add the command line parameters to the script dialog box. In the above screen shot, the complete Paranoid command line is truncated, it reads:
//T:120 D:\Scripts\SPAMSTATS.VBS "Paranoid (SPAM Probability {X-SPAM-PROB}"
This will give unique count for each probability. Items enclosed with {} are Mail Filter Pro tags. These values are filled by Mail Filter Pro when they are called by each rule.
Note: eWall and Mail Filter Pro use similar tags, a common difference is the use of MF or EW depending on which program you are using. Here is an example of a Mail Filter Pro tag, X-MF-TO. The same tag in eWall will look like this: X-EW-TO. For more information on the different tags that each program uses, please consult the Mail Filter and eWall documentation.
For each different filter, I pass the name of the filter to the script, so that the count for that filter can be updated. If the filter name does not exist in the database, it will be created. By including the filter name, and in the case with Paranoid, the probability, it will help me to more accurately report the statistics.
Finally, if you use the enclosed script, you will need to update the Database Name, User Name and Password for the script to work.
To see Spam Stats in action, view our demo. The demo is a real time display of the Mail Server statistics for the time frame as indicated on the top of the demo page. The demo was created using ArGoSoft Mail Server .NET Edition and eWall with the Paranoid spam filter using MS-SQL.
Related Downloads:
]