I found that the IMAP->message_to_file was just sitting waiting for input from the NetMail server I run. Simple fix; add a timeout to IMAP reads and increase the IMAP buffer size. This should let me get all of the body text for learning, and timeout on massive inline images.
I logged a bug and posted a fix to the DMZS-sa-learn.pl script
my $imap = Mail::IMAPClient->new(
Server => ‘foo.com:143’,
User => ‘spamtrainer’,
Password => ‘longpassword’,
Debug => ‘1’,
Timeout => ‘5’,
Buffer => ‘65536’,
Spam training is working perfectly now – Copfilter is eating its way through 3600 spam and about 6000 ham (non spam) messages.