mimefilter(1) filter a MIME message stripping unwanted MIME parts

SYNOPSIS

mimefilter [OPTIONS]

DESCRIPTION

The mimefilter script accept on STDIN a MIME conforming message, and outputs on STDOUT a MIME conforming message.

It strips every unwanted MIME part, warning by email the original author about this, and outputs a MIME compliant cleaned message, to be further processed by a mailing list software.

You may find it useful if you don't want certain attachments on your mailing lists, or if you want to allow just the text part from multipart/alternative messages, and so on. You can easily fine tune the list of allowed MIME types to suit your particular needs, using normal Perl regexps.

OPTIONS

The mimefilter script may take just an option, in either its short or long form:
-h, --help
Causes the script to print this very manpage and then succesfully exit.

However, the mimefilter script won't bark at you if it discovers you supplied some other options as well, it'll just politely ignore them.

ARGUMENTS

The mimefilter script cheerfully takes an unlimited number of command line arguments and happily discards them all.

FILES

The mimefilter script will look for a system wide configuration file in /etc/mimefilter.rc, and for a local, per working directory, configuration file in ./mimefilter.rc. The latter may be used to override any or all of the parameters defined by the former, thus allowing easily per mailing list customization.

Several configuration parameters are provided, the most important being the list of admissible MIME types (where Perl regexps may be used), along with the list of never to be allowed ones (so that you may even specify, e.g., 'text/.*' in the admissible types list and 'text/html' in the never to be allowed one, to allow every text part but html ones).

See the default configuration file for examples of use and further documentation.

ENVIRONMENT

The mimefilter script will look for the following environment variables:
list
The name of the mailing list this message is intended for. Used as the return address of the warning issued to the orginal author if the message is not already clean.

The Smartlist mailing list software will automatically pass this variable to mimefilter.

listaddr
The address of the mailing list this message is inteded for. Used in the X-Loop field of the warning issued to the original author if the message is not already clean.

The Smartlist mailing list software will automatically pass this variable to mimefilter.

listreq
The administrative (owner) address of the mailing list this message is inteded for. Used in the return address of the warning issued to the original author if the message is not already clean.

The Smartlist mailing list software will automatically pass this variable to mimefilter.

maintainer
The email address of the maintainer of the mailing list this message is inteded for. If it is defined, it is used to send the maintainer original carbon copies of messages that have been modified by this filter --- if filter_mime_cc_maintainer is affermative, of course.

The Smartlist mailing list software will automatically pass this variable to mimefilter.

filter_mime_cc_maintainer
A boolean flag: if affermative (i.e., if it matches the /y/i Perl regular expression), the mimefilter script will send carbon copies of every cleaned (modified) message to the maintainer of the mailing list the message is intended for.

Users of the Smartlist mailing list software may conveniently set this variable in rc.custom.

filter_mime
The mimefilter script itself will pay no attention to this variable, but if you have followed what the author suggests in the RECOMMENDED USE WITH THE SMARTLIST MAILING LIST SOFTWARE section, you will need to define it affermative in rc.custom to activate this script:

        filter_mime = yes

RETURN VALUE

The mimefilter script returns 0 on success and a positive integer on errors.

RECOMMENDED USE WITH THE SMARTLIST MAILING LIST SOFTWARE

Put the following lines in rc.local.s[012]0 (the right one just depends on your specific needs, look at rc.submit for more info):

    :0
    * filter_mime ?? y
    {
            # Pass the mail trough mimefilter
            :0 fw
            | mimefilter
            # Executed if mimefilter died
            :0 e
            {
                    :0 hfw
                    | formail -A "X-Diagnostic: MIME filtering failed"
                    HOST=continue_with_rc.request
            }
            # Trash empty messages (author's already been warned by mimefilter)
            :0 Bh
            * < 1
            /dev/null
    }

Also remember to uncomment the appropriate line in rc.custom, to activate rc.local.s[012]0, and don't forget to customize the list of admissibile and never to be allowed MIME types in the configuration file(s).

USING THIS SCRIPT WITH OTHER MAILING LIST SOFTWARE

The author believes no particular arrangements are necessary to use this script with mailing list software other than Smartlist, altough one should remember that mimefilter expects to find at least the list, listaddr, and listreq environment variables set.

BUGS

Naaa... ;-)

UNRESTRICTIONS

This program is copylefted. Refer to the GNU General Public License for conditions of use.

AUTHOR

This program has been written and is actively maintained by DavideĀ GiovanniĀ Maria Salvetti, <[email protected]>.

HISTORY

This script was originally aimed for use with a bunch of Smartlist served maling lists the author administers. He believes it can be successfully used with other mailing list softwares as well.