Test your body/header filter pattern matching
These are some useful commands that I have seen on the postfix mailing list for checking to make sure the body_checks and header_checks are reject the mails that you do not want (unsolicited commercial email UCE) and receiving the ones that you want.
first show the parameter value for header checks
% postconf -h header_checks
regexp:/etc/postfix/header_checks
%
Let’s assume that we have a header_checks file with this one line in it:
/super new viagra/ REJECT
We can do a test to see if the header checks will catch and reject things:
% postmap -q 'super new viagra' regexp:/etc/postfix/header_checks
REJECT
% postmap -q 'super new v1agra' regexp:/etc/postfix/header_checks
% postmap -q 'super viagra' regexp:/etc/postfix/header_checks
We see that the first example it succesfully rejected what was probably spam
with the regular expression syntax we could probably make a better filter
/super new v[i1]agra/ REJECT
is starting to get better. Hopefully you get the idea about expanding on this.
If you can save a spam mail as a single file then you can also very easily test body_checks
again check what type of map body_checks is (”postconf -m” will output the list of available
types on the system)
% postconf -h body_checks
regexp:/etc/postfix/body_checks
%
Let’s assume our body_checks file has one line in it with the following
/http:\/\/www.77yy4.com/ REJECT
we have a file with a line like this:
.........
ge£®£®£®we d0 what v1a9ra can't£®£®¡£
% postmap -q - regexp:/etc/postfix/body_checks < /tmp/message
£®¡£¡£ga1n up to 3" ln 1enqth ln just weeks
£®¡££®bec0me th1cker and ful1er
¡£¡£¡£mult1ple, more exp10slve or9asms
¡£¡££®end1ess staylng p0wer
¡££®£®say qo0d6ye to prema1lure ejacu1atl0n
¡££®¡£bo0st testoster0ne 1evels
£®£®£®increase confidence and vita1ity
please v1slt 0ur we6 s1te
This is a way that you can test you body_checks to make sure that certain mails fail and that others that you want to go through do not get rejected.





