MailScanner not working after upgrading from etch to lenny

I was just upgrading a spam filter from Debian etch to lenny. After the upgrade, MailScanner seemed to be running but wasn’t processing the queue.

When running MailScanner in debug mode I noticed these errors:

Variable "$FIELD_NAME" is not imported at /usr/share/MailScanner/MailScanner/Message.pm line 6064.
Variable "$FIELD_NAME" is not imported at /usr/share/MailScanner/MailScanner/Message.pm line 6067.
Global symbol "$FIELD_NAME" requires explicit package name at /usr/share/MailScanner/MailScanner/Message.pm line 6064.
Global symbol "$FIELD_NAME" requires explicit package name at /usr/share/MailScanner/MailScanner/Message.pm line 6067.
Compilation failed in require at /usr/sbin/MailScanner line 79.

To fix it, open the Message.pm file and this code to line #7852 (pico /usr/share/MailScanner/MailScanner/Message.pm):

our $FIELD_NAME = '[^\x00-\x1f\x7f-\xff :]+:';

so that lines 7852 – 7854 should be like this:

package Mail::Header;
our $FIELD_NAME = '[^\x00-\x1f\x7f-\xff :]+:';
 
sub extract

Restart MailScanner and everything should be fine now.