General-Purpose Mail Filter
The idea of the utility appeared in 2005, and its first version
appeared soon afterward. Back then it was a simple implementation of
Sender Address Verification (see SAV) for ‘Sendmail’ (hence
its name –
mailfromd) with rudimentary tuning
After a short run on my mail servers, I discovered that the utility was not flexible enough. It took less than a month to implement a configuration file that allowed the user to control program and data flow during the ‘envfrom’ SMTP state. The new version, 1.0, appeared in June, 2005.
Next major release, 1.2 (1.1 contained mostly bugfixes), appeared two months later, and introduced mail sending rate control (see Rate Limit).
The program evolved during the next year, and the version 2.0 was
released in September, 2006. This version was a major change in the
main idea of the program. Configuration file become a flexible filter
script allowing the operator to control almost all SMTP states. The
program supplied in the script file was compiled into a pseudo-code at
startup, this code being subsequently evaluated each time the filter
was invoked. This caused a considerable speed-up in comparison with
the previous versions, where the run-time evaluator was traversing the
parse tree. This version also introduced (implicitly, at the time),
two separate data types for the entities declared in the script, which
also played its role in the speed improvement (in the previous
versions all data were considered strings). Lots of improvements were
made in the filter language (MFL, see MFL) itself, such
as user-defined functions, the
switch statement, the
statement for handling run-time errors, etc. The set of
built-in functions extended considerably. A testsuite (using
DejaGNU) was introduced in this version.
During this initial development period the limitations
libmilter implementation became obvious. Finally,
I felt they were stopping further development, and decided
mailfromd should use its own ‘Milter’
implementation. This new library,
libgacopyz was the main
new feature of the 3.0 release, which was released in November, 2006.
Another major feature was the --dump-macros option and
rc.mailfromd script, that were intended
to facilitate the configuration on ‘Sendmail’ side.
The development of 3.x (more properly, 3.1.x) series concentrated mainly on bug-fixes, while the main development was done on the next branch.
The version 4.0 appeared on May 12, 2007. A full
list of changes in this release is more than 500 lines long, so it is
impractical to list them here. In particular, this version introduced
lots of new features in MFL syntax and the
library of useful MFL functions. The runtime engine was
also improved, in particular, stack space become expandable which
eliminated many run-time errors. This version also provided a
foundation for MFL module system. The code generation
was re-implemented to facilitate introduction of object files in
future versions. Another new features in this release include
SPF support and
mtasim utility — an MTA
simulator designed for testing
(see mtasim). The test suite in this version was made portable by
rewriting it in Autotest.
Another big leap forward was the 5.0 release, which appeared on December 26, 2008. It largely enriched a set of available functions (61 new functions were introduced, which amounts to 41% of all the available functions in 5.0 release) and introduced several improvements in the MFL itself. Among others, function aliases and optional arguments in user-defined functions were introduced in this release. The new “run operation mode” allowed to execute arbitrary MFL functions from the command line. This release also raised the Mailutils version requirements to at least 2.0.
Version 6.0, which was released in on 12 December, 2009, introduced a full-fledged modular system, akin to that of Python, and quite a few improvements to the language. such as explicit type casts, concatenation operator, static variables, etc.
Starting from version 7.0, the focus of further development of
mailfromd has shifted. While previously it had been regarded
as a mail-filtering server, since then it was developed as a system for
extending MTA functionality in the broad sense, mail
filtering being only one of features it provides.
Version 7.0 makes the MFL syntax more consistent and the language itself more powerful. For example, it is no longer necessary to use prefixes before variables to dereference them. The new ‘try--catch’ construct allows for elegant handling of exceptions and errors. User-defined exceptions provide a way for programming complex loops and recursions with non-local exits.
This version introduces a concept of dedicated callout server.
mailfromd to defer verifications for a later
time if the remote server does not response within a reasonably short
period of time (see SMTP Timeouts).
This document was generated on January 3, 2019 using makeinfo.Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.