banner proiect

Mail Filter


Mail Filter is a Mail Transport Agent (MTA) framework. The main goal is to implement a protection system against unsolicited or potentially harmful e-mail. However, its modular architecture makes Mail Filter suitable for a wide variety of applications that involve SMTP.


  • Can talk to any server that "speaks" SMTP - Spamassassin and Clamav (and virtually any other mail scanning software) can now be used with any SMTP server, without requiring special modules.
  • Proxy setup allows mail to be rejected right away when the recipient address is invalid (Mail Filter doesn't queue messages), thus avoiding bounces when the envelope sender address is forged.
  • SQL logging allows for a wide variety of mail traffic analysis, ranging from basic search to advanced reports.

Mail Filter is written entirely in C and uses a very simple multi-process model for handling several clients at the same time. Using a modular design, Mail Filter has an SMTP core and various modules that handle distinct functionality: SMTP client, Spamassassin integration, Clamav integration, SQL logging, etc.

Each module can install its own handle in all points of the SMTP transaction and optionally force a specific answer to the client.

Project Description


Currently all logic behind Mail Filter is hard-coded in the modules source code. This allows no user (administrator) control over the filtering process. Advanced setups (such as skipping the Spamassassin checks for some domains but only if they were authenticated with domain keys, while still going through the Clamav module) are nearly impossible in the current design.

Even if these advanced setups were possible, they would have involved a very complex configuration file and very complicated code to act upon all the possible paths resulting from the various configuration options.

In conclusion, configuration-driven behavior is not scalable and flexible enough.

Project Goal

The project goal is to provide the user (administrator) with the most flexible means of controlling the Mail Filter behavior. This can be achieved by integrating a scripting language into Mail Filter and moving all the logic from the various modules to the script. This way the behavior can be changed and customized without needing to understand the C language and the Mail Filter internals and without recompiling Mail Filter.

The idea is not new. It has been successfully applied on much more mature projects such as Opensips ( However, instead of inventing a new language (as they did), the main focus should be on integrating a well known and widely used language such as JavaScript.

There are many open-source JavaScript engine implementations, so there is no need to create a new one. It's just about studying them and choosing the one that's easiest to use and integrate with Mail Filter.

All the SMTP (server and client) protocol handling should remain inside the Mail Filter modules, as well as the low-level integration with third-party applications such as Spamassassin and Clamav. The JavaScript integration should provide an interface to this functionality by the means of some predefined objects, similar to the document and window objects in the web browser JavaScript environment.

All the logic that is currently implemented inside the Mail Filter modules must be ported to JavaScript. This will serve as a reference implementation for the Mail Filter users.

Required skills

  • C language: advanced
  • POSIX programming (generic): intermediate
  • POSIX sockets, process control, and pipes: intermediate
  • JavaScript language: intermediate
  • SMTP: beginner


Allevo Logo Eau de Web Logo Adobe Logo Stagii pe Bune Logo


ROSEdu Logo

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Creative Commons License