how to block mail where From and To are the same?

Julian Field MailScanner at
Fri Apr 27 16:25:22 IST 2007

Hash: SHA1

You could do this with a very simple Custom Function. It would just 
check to see if
1) There is only 1 recipient
2) The recipient address @{$message->{from}}[0] eq the sender address 

Don't trust the syntax is 100% accurate, my Perl is a bit rusty due to 
my hospital stay.

Quite which configuration option you would attach this to is left as an 
exercise for the reader :-)


Daniel Maher wrote:
> Hello all,
> Lately I have been receiving an increasingly large amount of spam 
> where both the From and To fields are identical (and, of course, 
> forged). The net result is that many of my users appear to be 
> receiving spam /from themselves/, which is causing some distress 
> amongst the user base.
> Now, there are a handful of ways to deal with this situation; however, 
> like always, the community probably already knows the best way to 
> block – or at least add SA points to – such spam.
> I’m using Postfix 2.0 (yes, I know), and the newest MailScanner & 
> SpamAssassin. Thank you all for your comments and suggestions.
> --
> _
> °v° Daniel Maher
> /(_)\ Administrateur Système Unix
> ^ ^ Unix System Administrator
> //“How can a man choose between Fresh and Fly? And believe me, there 
> IS a difference.” – Crack Stuntman, 2007.////


- -- 
Julian Field MEng CITP
Buy the MailScanner book at

MailScanner customisation, or any advanced system administration help?
Contact me at Jules at Jules.FM

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
For all your IT requirements visit

Version: PGP Desktop 9.6.1 (Build 1012)
Charset: windows-1252


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
For all your IT requirements visit

More information about the MailScanner mailing list