General-Purpose Mail Filter
The 6.0 release is aimed to fix several logical inconsistencies that
affected the previous versions. The most important one is that until
version 5.2, the filter script file contained both the actual filter
script, and the run-time configuration for
form of ‘#pragma option’ and ‘#pragma database’ statements).
The new version separates run-time configuration from the
filter script by introducing a special configuration file
mailfromd.conf (see Mailfromd Configuration).
Consequently, the ‘#pragma option’ and ‘#pragma database’ statements become deprecated. Furthermore, the following deprecated pragmas are removed: ‘#pragma option ehlo’, ‘#pragma option mailfrom’. These pragmas became deprecated in version 4.0 (see 31x-400).
The second problem was that the default filter script file had ‘.rc’ suffix, which usually marks a configuration file, not the source. In version 6.0 the script file is renamed to mailfromd.mf. In the absence of this file, the legacy file mailfromd.rc is recognized and parsed. This ensures backward compatibility.
This release also fixes various inconsistencies and dubious features in the MFL language.
The support for unquoted literals is discontinued. This feature was marked as deprecated in version 3.0.
The following features are deprecated: ‘#pragma option’ (pragma-option and ‘#pragma database’ (pragma-database) directives, the legacy style of function declarations (old-style function declarations), calls to functions of one argument without parentheses (operational notation), the ‘#require’ statement (See import, for the new syntax) and implicit concatenation (implicit concatenation). See Deprecated Features, for more information about these.
This release also introduces important new features, which are summarized in the table below:
|Configuration||See Mailfromd Configuration.|
|Module system||See Modules.|
|Explicit type casts||See explicit type casts.|
|Concatenation operator||See Concatenation.|
|Scope of visibility||See scope of visibility.|
|Precious variables||See rset.|
Mailfromd version ‘6.0’ will work with unchanged
scripts from ‘5.x’. When started, it will verbosely warn you
about any deprecated constructs that are used in your filter sources
and will create a script for upgrading them.
To upgrade your filter scripts, follow the steps below:
mailfromd: Warning: using legacy script file /usr/local/etc/mailfromd.rc mailfromd: Warning: rename it to /usr/local/etc/mailfromd.mf or use script-file statement in /usr/local/etc/mailfromd.conf to disable this warning mailfromd: /usr/local/etc/mailfromd.rc:19: warning: this pragma is deprecated: use relayed-domain-file configuration statement instead mailfromd: /usr/local/etc/mailfromd.rc:23: warning: this pragma is deprecated: use io-timeout configuration statement instead mailfromd: Info: run script /tmp/mailfromd-newconf.sh to fix the above warnings …
mailfromdwill create a shell script /tmp/mailfromd-newconf.sh for fixing these warnings. Run it:
$ sh /tmp/mailfromd-newconf.sh
mailfromd --lintagain. If it shows no more deprecation warnings, the conversion went correctly. Now you can remove the upgrade script:
$ rm /tmp/mailfromd-newconf.sh
Notice, that the conversion script attempts to fix only deprecation warnings. It will not try to correct any other type of warnings or errors. For example, you may get warning messages similar to:
mailfromd: /etc/mailfromd.mf:7: warning: including a module file is unreliable and may cause subtle errors mailfromd: /etc/mailfromd.mf:7: warning: use `require dns' instead
This means that you use ‘#include’ where you should have used ‘require’. You will have to fix such warnings manually, as suggested in the warning message.
If, for some reason, you cannot upgrade your scripts right now, you
may suppress deprecation warnings by setting the environment variable
MAILFROMD_DEPRECATION to ‘no’ before starting
mailfromd. Nonetheless, I recommend to upgrade as soon as
possible, because the deprecated features will be removed in version
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.