[Mimedefang] Mangling question...

Michael Sims michaels at crye-leike.com
Fri Sep 12 14:52:05 EDT 2003


mimedefang-admin at lists.roaringpenguin.com wrote:
> However, I'm getting bored with SSHing into it to pull out the spam
> and report it.  So I used the recipie in the archive
>
(http://lists.roaringpenguin.com/pipermail/mimedefang/2003-May/005668.html)
> to attach the original email.
>
> Now, what I'd really like to do is also attach, along with that
> email, the SpamAssassin report.

In the article you referenced there is this bit of code:

<quote>
my $report = MIME::Entity->build(
                        Type            => 'text/plain',
                        Description     => 'spam warning',
                        Data            => [
"One or more lines of text go here\n",
"These will appear in the body of the message that's been wrapped\n",
"so put whatever you want your users to see here.\n",
"\n",
"Note that it's an array of \\n terminated lines.\n",
                                                ],
                );

$entity->parts([$report]);
</quote>

This creates a new MIME::Entity which is stored in $report, and the last
line replaces all of the parts of $entity with the single part $report.  To
add the SpamAssassin report you can either edit the above $report to include
it, or you can add a new entity part.

I'm assuming you call spam_assassin_check() like this:

my($hits, $req, $names, $report) = spam_assassin_check();

If so, the report is in the variable $report.  That causes a problem with
the sample code in the article you referenced, since it also uses $report as
a MIME::Entity.  I'd suggest using $reportPart instead, so you end up with
something like this (untested):

<quote>
...

my($hits, $req, $names, $report) = spam_assassin_check();
...

my $reportPart = MIME::Entity->build(
                        Type            => 'text/plain',
                        Description     => 'spam warning',
                        Data            => [
"One or more lines of text go here\n",
"These will appear in the body of the message that's been wrapped\n",
"so put whatever you want your users to see here.\n",
"\n",
"Note that it's an array of \\n terminated lines.\n",
$report
                                                ],
                );

$entity->parts([$reportPart]);
</quote>

Note that the $report variable (which contains the SpamAssassin report) has
been appended onto the end of the "Data" parameter passed to
MIME::Entity->build().

If this isn't clear or you have problems feel free to email me your filter
offlist and I can help out...

___________________________________________
Michael Sims
Project Analyst - Information Technology
Crye-Leike Realtors
Office: (901)758-5648  Pager: (901)769-3722
___________________________________________




More information about the MIMEDefang mailing list