[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Sheflug] Perl Modules
>>>>> "Richard" == Richard Ibbotson <richard [at] sheflug.co.uk> writes:
Richard> Hi Anyone done anything with Mail::Audit before ?
Aye, all my email goes through it.
Richard> I'm trying to work out how to use Mail::Audit::KillDups
Richard> and the reject option for returning mail to a foreign
Richard> host after a dcc check.
Richard> Perldoc Mail::Audit reveals....
Read the documentation for Mail::Audit::KillDups:
http://search.cpan.org/~simon/Mail-Audit-2.1/Audit/KillDups.pm
The example is:
use Mail::Audit qw(KillDups);
$Mail::Audit::KillDups::dupfile = "/home/simon/.msgid-cache";
my $mail = Mail::Audit->new;
mail->killdups;
You can only detect and ignore dupes by the looks of things, not
choose to bounce, store or otherwise action a duplicate message.
Richard> I'm trying to work out how to integrate this into my
Richard> present script along with KillDups. My present
Richard> Mail::Audit script is below...
Richard> #!/usr/bin/perl
Richard> use strict;
Richard> use warnings;
Richard> use Mail::Audit;
Richard> use Mail::SpamAssassin;
Richard> my $mailbox = "/home/user/Mail/inbox";
Richard> my $mail = Mail::Audit->new( nomime => 1, );
Richard> my $spamtest = Mail::SpamAssassin->new();
Richard> my $status = $spamtest->check( $mail );
Richard> if ( $status->is_spam() ) {
Richard> $status->rewrite_mail();
Richard> $mail->accept( "/dev/null" );
Richard> } else {
Richard> $mail->accept( "home/user/Mail/inbox" );
Richard> }
One other thing with your script - you should use
$mail->ignore();
instead of
$mail->accept("/dev/null");
Since that's the whole point of the ignore() method.
There is also no point in rewriting the spam with
$status->rewrite_mail();
if you're going to bin it.
Cheers,
Baz.
--
Barrie J. Bremner
baz-sheflug [at] barriebremner.com http://barriebremner.com/
___________________________________________________________________
Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html
GNU the choice of a complete generation.