croscharge.blogg.se

Spamassassin rule
Spamassassin rule







spamassassin rule

  • rules with no score statement will be scored at 1.0, unless 3 or 4 is true.
  • rules with a score set to 0 are not evaluated at all.
  • header LOCAL_DEMONSTRATION_WEIRD_FROM ALL =~ /^FrOM\:/m Notes about rule scoresĪ few short words about the behavior of the "score" command. Note that if you want to use the '^' character here, you must put an m at the end of your line, which will look at the header one line at a time. Not very commonly used, but this feature can also be used to do a case-sensitive check on a header name (it will look at the whole lines, not just the parts after the colon). There's also an option to look at all the headers and match if any of them contain the specified regex: header LOCAL_DEMONSTRATION_ALL ALL =~ /test\.com/i is a wildcard, but this example will look for "" and not match "testzcom".

    #Spamassassin rule how to

    However, I wanted to illustrate how to make one, and also point out that some punctuation characters are part of the regex syntax, and if you want to use them literally, you need to put a \ in front of them. Usually if you're making a From line rule you'll be doing so to use more sophisticated rules. Now, that rule is pretty silly, as it doesn't do much that a blacklist_from can't. The header name itself is always case-insensitive, so the above rule will match a subject: line containing "test" or a SUBJECT: line containing "test".Ĭhecking the From: line, or any other header, works much the same: header LOCAL_DEMONSTRATION_FROM From =~ /test\.com/i

    spamassassin rule

    In these rules, the first part before the =~ indicates what the name of the header you want to check is, and the rest is a familiar regular expression. header LOCAL_DEMONSTRATION_SUBJECT Subject =~ /\btest\b/i Let's pick up our "test" rule and change it into one that checks the subject line. Most commonly these rules check the Subject, From, or To, but they can be written to check any message header, including non-standard ones. Header rules let you check a message header for a string.

    spamassassin rule

    - Learning Perl, 4th Edition - By biran d foy, Tom Phoenix, Randal L.Recommended book to learn the Perl programming language: - for users who already have some regexp experience.If you have perl-doc installed you can type at a linux shell prompt:.

    spamassassin rule

    You could use your linux box and it's perl documentation: Here's some sites you might want to check out for information on regular expressions: At this point, I've given you a taste of some of the syntax, but if you're not familiar with regular expressions, you can read one of the many tutorials on the web regarding them. I could easily write an entire book on the different kinds of syntax you can use. Perl Regular expressions are quite flexible and powerful. Now the rule will match any combination of upper or lower case that spells "test" surrounded by word breaks of some form. The rule can also be made case-insensitive by adding an i to the end, like this: body LOCAL_DEMONSTRATION_RULE /\btest\b/i Our rule above can be made to not match "testing" or "attest" like so: body LOCAL_DEMONSTRATION_RULE /\btest\b/ In regular expressions a \b can be used to indicate where a word-break (anything that isn't an alphanumeric character or underscore) must exist for a match. The describe statement contains the text which will be placed into the verbose report, if verbose reports are used (this is the default setting for the body, in Spamassassin version 2.5x and upwards). It will match "test" but also "testing" and "attest". Now, this rule is pretty simple as rules go. This rule does a simple case-sensitive search of the body of the email for the string "test" and adds a 0.1 to the score of the email if it finds it. Here is an example rule: body LOCAL_DEMONSTRATION_RULE /test/ĭescribe LOCAL_DEMONSTRATION_RULE This is a simple test rule Body rules also include the Subject as the first line of the body content. If the expression matches anything, the score is added to the grand total spam score. Body rulesīody rules search the body of the message with a regular expression. There is no need to prepend your own rules with LOCAL_ or any other convention. Note: Mailborder custom spam rules are automatically prepended with MC_ when created via the Mailborder GUI.









    Spamassassin rule