On Tue, 2016-06-14 at 16:47 +0100, spamassas...@linkcheck.co.uk wrote: > The code below is found in several places online and for some months > I have been trying to get it to work, but whatever I do it flags up > Fail even if the source is good. Typically I have been concentrating > on gmail: from known good contacts I always get NOTVALID_GMAIL (I > have reduced the scores to 0.01 to avoid false rejections). Is this > code known to fail or is it something I'm doing wrong? > A tip that may help to debug your code:
Recode this by replacing the double underscores with 'T_'. This will let you see which of your subrules are firing. When you're happy that they are all matching the stuff you want them to match, you can reverse the process to put e double underscores back. For this to help you must have a collection of spam that all these rules should match. Its OK to write your own minimal test messages to check individual regexes. Use something like: ================== ends ========================= To: m...@myaddress.com From: f...@example.com Subject: Subject Date: 9 Oct 2014 12:28:21 -0000 Some body text containing at least one match string . ================== starts ======================== You need at least these headers to stop SA from complaining about missing dates etc. You can add any other headers you need to test header rules. However, any meta-rules should be tested against real spam. Assuming you're running spamd rather that calling spamassassin directly, you can use spamc from a command line: spamc <testmsg1.txt | less to pass test messages through SA and see what rules fired. HTH Martin