ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FreeBSDAdmin/Mail/FalsePositive.pl
Revision: 924
Committed: 2007-05-30T22:32:06-07:00 (18 years ago) by douglas
Content type: text/x-perl
File size: 1175 byte(s)
Log Message:
All perl, no c-client.

File Contents

# Content
1 #!/usr/bin/perl
2 # False Positive
3 #
4 # Douglas Thrift
5 #
6 # $Id$
7
8 use strict;
9 use warnings;
10
11 use IMAP::Client;
12 use Mail::SpamAssassin;
13
14 my $debug = 0;
15
16 for my $arg (@ARGV)
17 {
18 if ($arg eq "-debug")
19 {
20 $debug = 1;
21 }
22 else
23 {
24 print "Usage: $0 [-debug]\n";
25
26 exit 1;
27 }
28 }
29
30 my $imap = new IMAP::Client;
31
32 $imap->onfail('ABORT');
33 $imap->debuglevel(1) if ($debug);
34 $imap->capability_checking(1);
35 $imap->connect(PeerAddr => 'mail.douglasthrift.net', ConnectMethod => 'STARTTLS');
36
37 {
38 my $user = getpwuid $<;
39
40 open PASS, "$ENV{HOME}/.CreditCardReminder.pass" or die "$0: $!\n";
41
42 my $pass = <PASS>;
43
44 chomp $pass;
45 close PASS;
46
47 $imap->authenticate($user, $pass);
48 }
49
50 $imap->select('Spam.False Positive');
51
52 my $messages = $imap->uidsearch('UNFLAGGED');
53
54 if (defined $messages)
55 {
56 my $assassin = Mail::SpamAssassin->new($debug ? {debug => 'all'} : {});
57 my %fetch = $imap->uidfetch($messages, {}, 'INTERNALDATE');
58
59 for my $message (values %fetch)
60 {
61 $imap->append('INBOX', $assassin->remove_spamassassin_markup($assassin->parse($message->{BODY}->{BODY})), '"' . $message->{INTERNALDATE} . '"');
62 $imap->uidstore($message->{UID}, '+FLAGS.SILENT', '\Flagged');
63 }
64 }
65
66 $imap->logout;

Properties

Name Value
svn:executable *
svn:keywords Id