diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-08-07 16:28:43 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-08-07 16:28:43 +0100 |
commit | c82ed6c21402329d5c06d4e650b40a93eb9e63be (patch) | |
tree | 5352f18c425a5a524d83b3eedc3e764413a463b0 /rules | |
parent | 41adea4d23e4ea23b029bfc63d0f8db6444a74ed (diff) | |
download | rspamd-c82ed6c21402329d5c06d4e650b40a93eb9e63be.tar.gz rspamd-c82ed6c21402329d5c06d4e650b40a93eb9e63be.zip |
Rework MISSING_SUBJECT rule.
Issue: #343
Reported by: @moisseev
Diffstat (limited to 'rules')
-rw-r--r-- | rules/regexp/headers.lua | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/rules/regexp/headers.lua b/rules/regexp/headers.lua index f026d548b..9255de792 100644 --- a/rules/regexp/headers.lua +++ b/rules/regexp/headers.lua @@ -32,11 +32,16 @@ reconf['SUBJECT_NEEDS_ENCODING'] = string.format('!(%s) & !(%s) & (%s)', subject -- Detects that there is no space in From header (e.g. Some Name<some@host>) reconf['R_NO_SPACE_IN_FROM'] = 'From=/\\S<[-\\w\\.]+\\@[-\\w\\.]+>/X' --- Detects missing subject -local has_subject = 'header_exists(Subject)' -local empty_subject = 'Subject=/^$/' --- Final rule -reconf['MISSING_SUBJECT'] = string.format('!(%s) | (%s)', has_subject, empty_subject) + +rspamd_config.MISSING_SUBJECT = function(task) + local hdr = task:get_header('Subject') + + if not hdr or #hdr == 0 then + return true + end + + return false +end -- Detects bad content-transfer-encoding for text parts -- For text parts (text/plain and text/html mainly) |