[Mimedefang] how to build SA-compatible encapsulated spam message?

Gary Funck gary at intrepid.com
Fri Dec 31 19:46:22 EST 2004


Presently, MIMEdefang can be configured to add the SpamAssassin report
as a separate text attachment to the orignal message. The code that
does this is in mimedefang-filter at approximately line 317:

            if ($hits >= $req) {
                action_change_header("X-Spam-Score", "$hits ($score)
$names");
                md_graphdefang_log('spam', $hits, $RelayAddr);

                # If you find the SA report useful, add it, I guess...
                action_add_part($entity, "text/plain", "-suggest",
                                "$report\n",
                                "SpamAssassinReport.txt", "inline");

Although this code performs its intended purpose, it creates a mail message
that is incompatible with the SA -d (remove markup) switch.  Spamassassin
creates a message of the form:

header:
Content-Type: multipart/mixed; boundary="----------=_41CC5623.58847487"

body:

This is a multi-part message in MIME format.

------------=_41CC5623.58847487
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

[spamassassin report]


------------=_41CC5623.58847487
Content-Type: message/rfc822; x-spam-type=original
Content-Description: original message before SpamAssassin
Content-Disposition: attachment
Content-Transfer-Encoding: 8bit

[... original unaltered message]


------------=_41CC5623.58847487--

===============================================================

This message format is useful, because (for example) spam messages
can be fed back into SA for unlearning if they were false positives,
and for building a clean mbox file that contains only the original
spam messages.  SA doesn't understand the mail message format
created by MIMEdefang's default action.

What actions are required to have MIMEdefang build a spam message
containing the report and the original message, as outlined above?

thanks - Gary






More information about the MIMEDefang mailing list