Mark,

This sounds great; thanks for posting the script.  One question: does
this method preserve the message headers?  I've had a lot of problems
keeping the headers intact with Exchange 2000/Public Folders/IMAP.

Ryan

-----Original Message-----
From: Mark Motley [mailto:[EMAIL PROTECTED] 
Sent: Saturday, June 21, 2003 4:27 PM
To: Marek Dohojda
Cc: [EMAIL PROTECTED]
Subject: RE: [SAtalk] Public folders, IMAP

Yes.  I've written a simple Perl script to pull all the ham/spam off of
an Exchange 2000 server via IMAP and run sa-learn on them.  

Basically, users drag/drop spam and ham to a shared Public Folder and
this script connects via IMAP and pulls those down to sequential files
in a directory.  Finally, sa-learn is run against those in --dir mode.

I have two scripts, pullspam and pullham, that only differ in the
directory where they pull the ham/spam and the Public Folder path.  The
pullham script is included below.

It requires Mail::IMAPClient module from CPAN.

Although I've used it against an Exchange 2000 server, I don't see why
one couldn't modify it for another IMAP implementation.  I've used this
on my Exchange server for about 2 months now and it works great.

Note the locations where you will need to change things...

------- cut here --------

#!/usr/bin/perl

use Mail::IMAPClient;
use Sys::Syslog;

# You may need to change the Public Folders path to suit your server 
my $FOLDER_NAME = 'Public Folders/Spam Filter Teaching/Ham'; 
my $SEQ = 1; openlog('pullham','cons,pid', 'user');

my $server = Mail::IMAPClient->new(
        Server => "<exchange server hostname/IP>",
        User => "<user ID to authenticate with IMAP>",
        Password => "<Password>",
        Uid => 1,
        Debug => 0 );

$server->select($FOLDER_NAME);
my @msgs = $server->search("ALL");
foreach my $msg (@msgs) {
        $server->message_to_file("/var/spam/ham/" . $SEQ,$msg);
        $server->delete_message($msg);
        $SEQ++;
};
$server->expunge($FOLDER_NAME);
print "Pulled ". ($SEQ-1) . " messages from ham folder.\n"; 
syslog('mail|info', 'Pulled '.($SEQ-1) . ' messages from ham folder.');


-------- that's all --------

-----Original Message-----
From: Marek Dohojda [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 20, 2003 3:58 PM
To: [EMAIL PROTECTED]
Subject: [SAtalk] Public folders, IMAP

Hello everyone

I hope this questions hasn't been asked before.  If so, me sorry :)

As most of you know Outlook doesn't forward headers when you forward an
e-mail (and with newer Outlook 2002+, you can't even resend with headers
intact).  Therefore Outlook is a bad tool in traning SA.

Unfortuantely I don't have a choice, Outlook and exchange is a must for
me. 

Therefore I have an idea, of allowing users to put their spam in a
public folder.  Then a text IMAP client would grab this and put it in a
folder on the SA server.  Then just do the sa-learn and bingo.. Spam
learn.

My question is.. Has anybody tried this? If so what tools worked for
you.  I am looking for a text based IMAP client that can see into public
folders, and transfer files within it.

Thank you!!

This correspondence is considered confidential and any reproduction for
the purpose of public disclosure is forbidden without written permission
by the author signed above. If you are not the intended recipient,
please immediately notify the sender and delete any copies.


-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Spamassassin-talk mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk


-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk


-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to