[Rspamd] Log mail that was put into junk folder and keep a copy in quarantine
parent
347217c2d3
commit
6d46ee795b
|
@ -53,7 +53,9 @@ return function(task)
|
||||||
and not task:has_symbol('GLOBAL_RCPT_BL')
|
and not task:has_symbol('GLOBAL_RCPT_BL')
|
||||||
and not task:has_symbol('MAILCOW_BLACK') then
|
and not task:has_symbol('MAILCOW_BLACK') then
|
||||||
local action = task:get_metric_action('default')
|
local action = task:get_metric_action('default')
|
||||||
return (action == 'reject')
|
if action == 'reject' or action == 'add header' then
|
||||||
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
|
@ -220,15 +220,8 @@ foreach (json_decode($rcpts, true) as $rcpt) {
|
||||||
foreach ($rcpt_final_mailboxes as $rcpt_final) {
|
foreach ($rcpt_final_mailboxes as $rcpt_final) {
|
||||||
error_log("QUARANTINE: quarantine pipe: processing quarantine message for rcpt " . $rcpt_final . PHP_EOL);
|
error_log("QUARANTINE: quarantine pipe: processing quarantine message for rcpt " . $rcpt_final . PHP_EOL);
|
||||||
try {
|
try {
|
||||||
// Fall back to reject
|
$stmt = $pdo->prepare("INSERT INTO `quarantine` (`qid`, `subject`, `score`, `sender`, `rcpt`, `symbols`, `user`, `ip`, `msg`, `action`, `fuzzy_hashes`)
|
||||||
if ($action == "add header") {
|
VALUES (:qid, :subject, :score, :sender, :rcpt, :symbols, :user, :ip, :msg, :action, :fuzzy_hashes)");
|
||||||
$action = "header";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$action = "reject";
|
|
||||||
}
|
|
||||||
$stmt = $pdo->prepare("INSERT INTO `quarantine` (`qid`, `subject`, `score`, `sender`, `rcpt`, `symbols`, `user`, `ip`, `msg`, `action`, `fuzzy_hashes`, `type`)
|
|
||||||
VALUES (:qid, :subject, :score, :sender, :rcpt, :symbols, :user, :ip, :msg, :action, :fuzzy_hashes, :type)");
|
|
||||||
$stmt->execute(array(
|
$stmt->execute(array(
|
||||||
':qid' => $qid,
|
':qid' => $qid,
|
||||||
':subject' => $subject,
|
':subject' => $subject,
|
||||||
|
@ -240,8 +233,7 @@ foreach ($rcpt_final_mailboxes as $rcpt_final) {
|
||||||
':ip' => $ip,
|
':ip' => $ip,
|
||||||
':msg' => $raw_data,
|
':msg' => $raw_data,
|
||||||
':action' => $action,
|
':action' => $action,
|
||||||
':fuzzy_hashes' => $fuzzy,
|
':fuzzy_hashes' => $fuzzy
|
||||||
':type' => $action
|
|
||||||
));
|
));
|
||||||
$stmt = $pdo->prepare('DELETE FROM `quarantine` WHERE `rcpt` = :rcpt AND `id` NOT IN (
|
$stmt = $pdo->prepare('DELETE FROM `quarantine` WHERE `rcpt` = :rcpt AND `id` NOT IN (
|
||||||
SELECT `id`
|
SELECT `id`
|
||||||
|
|
Loading…
Reference in New Issue