The 'Can't locate Mail/SpamAssassin/NoMailAudit.pm' error

In SpamAssassin 3.0.0, we switched over to a new message-parsing public API. This means that tools which use the SpamAssassin perl modules will need to update to use the new interface. A typical symptom is this error message:

  Can't locate Mail/SpamAssassin/NoMailAudit.pm in @INC (@INC contains: 
  lib /home/jm/ftp/spamassassin/lib /etc/perl /usr/local/lib/perl/5.8.3 
  /usr/local/share/perl/5.8.3 /usr/lib/perl5 /usr/share/perl5 
  /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl 
  /usr/local/lib/perl/5.8.2 /usr/local/share/perl/5.8.2 .) 
  at /home/jm/bin/handlespam line 66.
  BEGIN failed--compilation aborted at /home/jm/bin/handlespam line 66.

To fix this, the calling code needs to be updated to use the new parse() API on the Mail::SpamAssassin object. You should check the web site where you obtained that code, to see if they've released an update to support 3.0.0.

If the script in question is part of the SpamAssassin distribution, such as 'spamassassin' or 'spamd', it's very likely that you're not running the 3.0.0 version of that tool, and instead the older 2.x version is still installed on your system, and still in the PATH.

Making the change yourself

If one isn't already there, and you're comfortable making the change in the perl code yourself, here are some quick changes to head in the right direction:

  1. look for lines like:
  my $mail = Mail::SpamAssassin::NoMailAudit->new( data => \@msgtext );

change that to something like this:

  my $mail = $spamtest->parse( \@msgtext );

also, calls to $spamtest->rewrite_mail(); and then outputing the header/body can just be replaced by print $spamtest->rewrite_mail();, which will spit out the full message, rewritten.

$spamtest should be replaced with whatever the reference to the Mail::SpamAssassin object is called, in that code.

2. Remove any lines like

  use Mail::SpamAssassin::NoMailAudit;

at the top of the perl source files.