You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Kenneth Porter <sh...@sewingwitch.com> on 2005/05/19 22:49:59 UTC
OT: Perl IMAP client
I'd like to knock together a utility for invoking SA against messages in an
IMAP store, and it seems logical to build it as a Perl program using an
IMAP package and Mail::SpamAssassin. Can anyone recommend a good Perl IMAP
package?
Server will be Dovecot on Fedora. My utility will take all messages in a
folder of uncaught spam that aren't wrapped in a SA report, run them
through the equivalent of sa-learn, wrap them in a SA report, and clear
their "seen/read" state.
Here's all the hits I get on CPAN for stuff about IMAP:
<http://search.cpan.org/search?m=all&q=imap&s=1&n=100>
Re: OT: Perl IMAP client
Posted by Craig McLean <cr...@craig.dnsalias.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Kenneth Porter wrote:
| I'd like to knock together a utility for invoking SA against messages in
| an IMAP store..[snip]
Kenneth,
I use DMZS-sa-learn here, with some local modifications.
http://www.dmzs.com/tools/files/spam.phtml
Regards,
Craig.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFCjyF9MDDagS2VwJ4RAmE9AKDOYUDoZEWo8gGJYPJjH52n1b6mFwCgt5KX
Qw5v+GhqNg5NKTOhqJCwUtw=
=N9Gu
-----END PGP SIGNATURE-----
Re: OT: Perl IMAP client
Posted by Martin Hepworth <ma...@solid-state-logic.com>.
Kenneth
here's what I use do just that - code originally from someone else.
mangled slightly by me..
--
Martin Hepworth
Snr Systems Administrator
Solid State Logic
Tel: +44 (0)1865 842300
Kenneth Porter wrote:
> I'd like to knock together a utility for invoking SA against messages in
> an IMAP store, and it seems logical to build it as a Perl program using
> an IMAP package and Mail::SpamAssassin. Can anyone recommend a good Perl
> IMAP package?
>
> Server will be Dovecot on Fedora. My utility will take all messages in a
> folder of uncaught spam that aren't wrapped in a SA report, run them
> through the equivalent of sa-learn, wrap them in a SA report, and clear
> their "seen/read" state.
>
> Here's all the hits I get on CPAN for stuff about IMAP:
>
> <http://search.cpan.org/search?m=all&q=imap&s=1&n=100>
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote confirms that this email message has been swept
for the presence of computer viruses and is believed to be clean.
**********************************************************************
Re: Perl IMAP client
Posted by John Rudd <jr...@ucsc.edu>.
On May 19, 2005, at 15:34, Bret Miller wrote:
>> I'd like to knock together a utility for invoking SA against
>> messages in an
>> IMAP store, and it seems logical to build it as a Perl
>> program using an
>> IMAP package and Mail::SpamAssassin. Can anyone recommend a
>> good Perl IMAP package?
>>
I have used Mail::IMAPClient. It works decently enough.
RE: Perl IMAP client
Posted by Bret Miller <br...@wcg.org>.
> I'd like to knock together a utility for invoking SA against
> messages in an
> IMAP store, and it seems logical to build it as a Perl
> program using an
> IMAP package and Mail::SpamAssassin. Can anyone recommend a
> good Perl IMAP package?
>
> Server will be Dovecot on Fedora. My utility will take all
> messages in a
> folder of uncaught spam that aren't wrapped in a SA report, run them
> through the equivalent of sa-learn, wrap them in a SA report,
> and clear their "seen/read" state.
>
> Here's all the hits I get on CPAN for stuff about IMAP:
>
> <http://search.cpan.org/search?m=all&q=imap&s=1&n=100>
>
I use IO::Socket here and just send the commands manually. Something
like this:
#
========================================================================
==========================
sub imap_connect {
$imap = new IO::Socket::INET(
PeerAddr => $CGServerAddress,
PeerPort => 143)
|| die "*** Can't connect to CGPro via IMAP.\n";
$imap->autoflush(1);
my $responseLine = <$imap>;
unless (imap_send("LOGIN \"$PostmasterLogin\"
\"$PostmasterPassword\""))
{
die "*** Can't login to CGPro IMAP: $responseLine.\n"
}
}
#
========================================================================
==========================
sub imap_send
{
my $responseLine = "";
print "\nCOMMAND: $_[0]\n" if $debug_verbose;
print $imap "x $_[0]\n";
until($responseLine =~/^x /)
{
$responseLine = <$imap>;
print "ANSWER: $responseLine" if $debug_verbose;
}
return $responseLine =~ /^x OK/;
}
#
========================================================================
==========================
sub imap_disconnect
{
imap_send("LOGOUT");
}