|
The EmailAgent is a simple application. I created it to be run from the command line, because I knew that I wanted to start it from a crontab file approximately every five minutes. The application can run on any computer platform that supports a 1.4.x version of the JVM. To perform its basic spam-filtering function it connects to your POP or IMAP mail server.
For the process of forwarding my email to my pager the application also connects to a simple web service (read ``CGI program''). When the agent finds a message that matches the criteria I've specified, it performs an HTTP GET operation to the CGI program, providing the phone number of my pager, along with the message details. I find this to be simple, but very effective.
This simple architecture is shown graphically in the next figure.
The software design is also very simple, consisting of less than 20 classes. The most important classes for the purposes of this discussion are the EmailAgentController, which controls the basic flow of the application; the EmailMessage, which is my representation of an email message in the real world; and the EmailAgent, which contains the logic that helps determine whether a message is spam or not.
The basic algorithm of the Email Agent looks like this:
- Application startup.
- Initialize logger.
- Read mail server connection properties.
- Read properties for sending a summary report to the user.
- Initialize internal lists from configuration files.
- Create and populate the EmailAgent.
- Connect to the mailbox.
- Remove spam from the current folder.
- Get the message list from the inbox.
- Determine the UIDs of these messages.
- Get a list of messages that have already been examined already.
- While only looking at new messages:
- One at a time, review each message to determine whether or not it is spam.
- If the message matches an ``allow'' file rule, let it pass through.
- Otherwise, test the From, Reply-To, and Subject fields, as well as message attachments.
- If a message matches a notification criteria, send a message to my pager.
- Close the mailbox and store.
- Send me summary information about what actions were taken.
Hopefully that shows that this is a simple, straightforward implementation of an anti-spam engine, with additional notification capabilities.
Next: Configuring the application
Up: A quick introduction to
Previous: A quick introduction to
|
|