1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

HOWTO: enable messages larger than 256k to be learned by sa-learn

Discussion in 'Plesk 9.x for Linux Issues, Fixes, How-To' started by Paul Martin, Aug 26, 2009.

  1. Paul Martin

    Paul Martin Guest

    I have a custom script for learning customer spam emails that was largely proving worthless because the sa-learn mail size per message was capped at 256k. After a bit of digging, I found out how to change that (at least on a CentOS5.3 system).

    1) go to /usr/lib/perl5/vendor_perl/5.8.8/Mail/SpamAssassin
    2) edit ArchiveIterator.pm
    3) you'll see a line near the top that looks like: use constant BIG_BYTES => 256*1024;
    4) change the 256 to whatever you want. I chose 1024 because that seemed to provide the best bang for my buck.

    Be careful though, if you set it too high, you could very well bring the server to its knees.

    Hope this helps someone out there.
  2. Paul Martin

    Paul Martin Guest

    ...and in addition to this...

    I just noticed that the 256k limitation is still in effect for mail messages that come in and are NOT run through sa-learn. The only way I've found to remedy this is to download the source of spamassassin and go into the /spamc/ dir, and compile that binary yourself. Takes all of 4 seconds.

    Once that's done, go into /usr/local/psa/handlers/hooks, and replace the "spam" binary with the newly compiled "spamc" binary. Rename it to "spam" (of course). Make sure you chmod it to 550 and chgrp it to popuser.

    These details hold true for PSA 9.2 on a CentOS 5.3 box. YMMV.

    Again, hope it helps someone out there.