SMTP AUTH and skipping MailScanner Spam checks.

Jim Barber jim.barber at
Tue Apr 17 10:51:34 IST 2007

Thanks everyone for your help.
The following works as a solution for me.

First of all the exim config file needs to be set up to add a header for authenticated users.
Within the 'acl_check_rcpt:' section of the config file I added something like:

	  authenticated = *
	  add_header = X-SMTP-Auth: Yes
	  control = submission/sender_retain

You also of course have to have SMTP authentication setup for Exim as well.

Then inside /etc/MailScanner/CustomFunctions/ I created a file called with the following contents:

	package MailScanner::CustomConfig;

	use strict;

	sub InitCheckSMTPAuth
	   # Empty

	sub EndCheckSMTPAuth
	   # Empty

	sub CheckSMTPAuth
	   my ($message) = @_;
	   return 1 unless $message;

	   foreach (@{$message->{headers}})
	           if (/X-SMTP-Auth: Yes/)
	                   MailScanner::Log::InfoLog("Message %s from (%s) is authenticated", $message->{id}, $message->{fromuser});
	                   return 0;
	   return 1;


Then in the /etc/MailScanner/MailScanner.conf file I have the following setting:

	Spam Checks = &CheckSMTPAuth

I've restarted MailScanner and everything seems to be working as I want.


Jim Barber
DDI Health

More information about the MailScanner mailing list