-- Module for checking mail list headers
local symbol = 'MAILLIST'
-
+local rspamd_logger = require "rspamd_logger"
-- EZMLM
-- Mailing-List: .*run by ezmlm
-- Precedence: bulk
-- List-Help: <mailto:
-- List-Unsubscribe: <mailto:[a-zA-Z\.-]+-unsubscribe@
-- List-Subscribe: <mailto:[a-zA-Z\.-]+-subscribe@
-function check_ml_ezmlm(task)
+local function check_ml_ezmlm(task)
local message = task:get_message()
-- Mailing-List
local header = message:get_header('mailing-list')
-- List-Unsubscribe: .*<mailto:.*=unsubscribe>
-- List-Archive:
-- X-Mailman-Version: \d
-function check_ml_mailman(task)
+local function check_ml_mailman(task)
local message = task:get_message()
-- Mailing-List
local header = message:get_header('x-mailman-version')
-- List-Archive: <http://subscribe.ru/archive/.*>
-- List-Owner: <mailto:.*-owner@subscribe.ru>
-- List-Post: NO
-function check_ml_subscriberu(task)
+local function check_ml_subscriberu(task)
local message = task:get_message()
-- List-Id
local header = message:get_header('list-id')
end
-- RFC 2369 headers
-function check_rfc2369(task)
+local function check_rfc2369(task)
local message = task:get_message()
local header = message:get_header('List-Id')
if not header then
end
-- RFC 2919 headers
-function check_rfc2919(task)
+local function check_rfc2919(task)
local message = task:get_message()
local header = message:get_header('List-Id')
if not header or not string.find(header[1], '^<.+>$') then
-- header exists X-Google-Loop
-- RFC 2919 headers exist
--
-function check_ml_googlegroup(task)
+local function check_ml_googlegroup(task)
local message = task:get_message()
local header = message:get_header('X-Google-Loop')
-- Check Precendence for 'Bulk' or 'List'
--
-- And nothing more can be extracted :(
-function check_ml_majordomo(task)
+local function check_ml_majordomo(task)
local message = task:get_message()
local header = message:get_header('Sender')
if not header or (not string.find(header[1], '^owner-.*$') and not string.find(header[1], '^.*-owner$')) then
-- X-Listserver = CommuniGate Pro LIST
-- RFC 2919 headers exist
--
-function check_ml_cgp(task)
+local function check_ml_cgp(task)
local message = task:get_message()
local header = message:get_header('X-Listserver')
return check_rfc2919(task)
end
-function check_maillist(task)
+local function check_maillist(task)
if check_ml_ezmlm(task) then
task:insert_result(symbol, 1, 'ezmlm')
elseif check_ml_mailman(task) then
local opts = rspamd_config:get_all_opt('maillist')if opts then
if opts['symbol'] then
symbol = opts['symbol']
- rspamd_config:register_symbol(symbol, 1.0, 'check_maillist')
+ rspamd_config:register_symbol(symbol, 1.0, check_maillist)
end
end