Re: Mail::Audit and MovableType
Bowen Dwelle <[email protected]> Thu, 13 May 2004 09:08:05 -0500
| Newsgroups | gmane.comp.lang.perl.modules.mail-audit |
|---|---|
| Message-ID | <[email protected]> |
My system works the same way: my .forward sends mail to mailfilter.pl,
which uses Mail::Audit and Mail::SpamAssassin for filtering, and
Net::Blogger for moblogging...
It all works very well; my only (rather tangential) complaint is that
once in a long while when I get a false positive, Mozilla Thunderbird
doesn't allow me to extract the original message which is attached to
SpamAssassin's marked up copy. This rarely happens, and I can use pine
to extract the original. Hopefully a forthcoming version of TBird will
fix this.
-- Bowen
Robert Nicholson wrote:
> I also use Mail-audit with SpamAssassin.
>
> I'm curious how are you integrating the two.
>
> I have a .pl script that's called by qmail when mail is delivered to my
> account
> and that perl script basically filters using Mail::Audit and uses
> SpamAssassin to determine
> which messages are spam.
>
> my $spamtest = new Mail::SpamAssassin({
> PREFIX => $PREFIX,
> DEF_RULES_DIR => $DEF_RULES_DIR,
> LOCAL_RULES_DIR => $LOCAL_RULES_DIR,
> });
>
> my $mail = Mail::Audit->new(
> nomime=> 1,
> emergency=>"$maildir/.emergency/",
> loglevel=>2,
> log=>$log
> );
>
> sub noma_from_string_or_arrayref {
> my $arrayRef = (ref $_[0] eq 'ARRAY') ? $_[0] : [ split /^/m, $_[0] ];
> my $no_audit = Mail::SpamAssassin::NoMailAudit->new ('data' =>
> $arrayRef);
> return $no_audit;
> }
>
> sub ma_from_string_or_arrayref {
> my $arrayRef = (ref $_[0] eq 'ARRAY') ? $_[0] : [ split /^/m, $_[0] ];
> my $mail_audit = Mail::Audit->new(
> nomime=> 1,
> emergency=>"$maildir/.emergency/",
> loglevel=>2,
> log=>$log,
> data=>$arrayRef);
> return $mail_audit;
> }
>
> if ($status->is_spam()) {
> # remove bogus attachments
> my $learnmail = noma_from_string_or_arrayref($mail->as_string);
> my $learn_status = $spamtest->learn($learnmail, undef, 1); # learn
> as spam
> my @newLines = removeSuspiciousAttachments($learnmail);
> $mail = ma_from_string_or_arrayref(\@newLines);
> log_mbox($mail, " Spamassassin has determined this mail is SPAM
> accepting to
> folder " . replace_dot_with_slash($spam) . "\n\n");
> $mail->accept("$maildir/.$spam/");
> # terminates here
> }
>
> On Apr 26, 2004, at 3:07 PM, Jeff Bisbee wrote:
>
>> Casey,
>>
>> I was just about to do something like this so I could photo blog with my
>> phone :) Thanks!
>>
>> BTW, wanted to share something I came up with for my filter (nothing new
>> but pretty handy) Often times my wife needs to get copies of e-mails
>> that get sent to me (credit card e-mail alerts, netflix, e-bay auction
>> notices, etc) Anyway I threw together this snippet to strip out images
>> (because yahoo marks e-mails as spam if the source images aren't for the
>> site where the e-mail originated from) and just creates a copy and sends
>> it on its way. After looking at it again, it could be cut down a bit,
>> but it worked, I just left it :)
>>
>> our @forward_addresses = qw([email protected]);
>>
>> # resend($msg) is to copy any ebay/netflix/cingular emails to
>> # my wife Heather # Mail::Audit->resend didn't work because the
>> # headers did match the host it was sent from so it was marked as
>> # spam by yahoo also html src images didn't match the domain of
>> # where the mail originated from so I just stripped those out
>> if ($msg->to =~ /netflix/ ||
>> $msg->to =~ /ebay/ ||
>> $msg->to =~ /discover/ ||
>> $msg->to =~ /cingular/) {
>> resend($msg);
>> }
>>
>> sub resend
>> {
>> my ($msg) = @_;
>> my $from = $msg->from;
>> $from =~ s/\<.+?\>//;
>> $from =~ s/\"//g;
>> my $body = join('',@{$msg->body});
>> $body =~ s/\<img .*?src.+?\>//gis; # strip out images :D
>> for my $address (@forward_addresses) {
>> my %mail = (
>> To => $address,
>> From => '"' . $from . '" <' . $msg->to . '>',
>> Subject => $msg->subject,
>> Message => $body,
>> );
>> # forward whatever headers you want
>> for my $header ('Mime Version', 'Content-Type') {
>> if (my $value = $msg->get($header)) {
>> $mail{$header} = $value;
>> }
>> }
>> sendmail(%mail);
>> }
>> }
>>
>>
>> * Casey West ([email protected]) wrote:
>>
>>> It was Monday, April 26, 2004 when Bowen Dwelle took the soap box,
>>> saying:
>>> : I've been using Mail::Audit for at least a couple of years now, and
>>> I've
>>> : had it integrated with Mail::SpamAssassin for quite a while. Just now,
>>> : I've hooked in Net::Blogger so that I can post to my MovableType blog
>>> : automatically via email (e.g. from a camera phone). Perhaps someone
>>> else
>>> : has already done this?
>>>
>>> http://caseywest.com/code/scripts/post-journal.pl
>>>
>>> I use Verizon in the US, you may have to play with it to get your
>>> camera phone to work. I also syndicate to use Perl;, and this is how.
>>>
>>> Enjoy!
>>>
>>> Casey West
>>>
>>> --
>>> Shooting yourself in the foot with BASIC (interpreted)
>>> You shoot yourself in the foot with a water pistol until your leg is
>>> waterlogged and rots off.
>>>
>>>
>>> _______________________________________________
>>> mail-audit mailing list
>>> [email protected]
>>> http://lists.netthink.co.uk/listinfo/mail-audit
>>>
>>>
>>
>>
>> -- Jeff Bisbee / [email protected] / jbisbee.com
>>
>> _______________________________________________
>> mail-audit mailing list
>> [email protected]
>> http://lists.netthink.co.uk/listinfo/mail-audit
>
>
>
> _______________________________________________
> mail-audit mailing list
> [email protected]
> http://lists.netthink.co.uk/listinfo/mail-audit