SMTP AUTH and skipping MailScanner Spam checks.

Jim Barber jim.barber at ddihealth.com
Tue Apr 17 11:25:12 IST 2007


Further to my post below you probably also want to strip out the added header when sending the messages out externally from your 
email server.

For my example below, in my exim configuration file I have the following added to my "remote_smtp:" transport.
Add it to any transport that you deem necessary.

	headers_remove = X-SMTP-Auth

Regards,

----------
Jim Barber
DDI Health


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:

	accept
	  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 CheckSMTPAuth.pm 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;
	}

	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.

Regards,

----------
Jim Barber
DDI Health


More information about the MailScanner mailing list