Quarantine notifications - don't send if sender is blacklisted (#3428)

Signed-off-by: Kristián Feldsam <feldsam@gmail.com>
master
Kristian Feldsam 2020-03-24 15:51:03 +01:00 committed by GitHub
parent 8c74996ac9
commit fd49958a00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -97,7 +97,10 @@ def notify_rcpt(rcpt, msg_count, quarantine_acl):
print('%s' % (ex))
time.sleep(3)
records = query_mysql('SELECT IFNULL(user_acl.quarantine, 0) AS quarantine_acl, count(id) AS counter, rcpt FROM quarantine LEFT OUTER JOIN user_acl ON user_acl.username = rcpt WHERE notified = 0 AND rcpt in (SELECT username FROM mailbox) GROUP BY rcpt')
records = query_mysql('SELECT IFNULL(user_acl.quarantine, 0) AS quarantine_acl, count(id) AS counter, rcpt, sender FROM quarantine LEFT OUTER JOIN user_acl ON user_acl.username = rcpt WHERE notified = 0 AND rcpt in (SELECT username FROM mailbox)
# dont send notifications for blacklisted senders
AND (SELECT prefid FROM filterconf WHERE option = "blacklist_from" AND (object = rcpt OR object = SUBSTRING(rcpt, LOCATE("@", rcpt) + 1)) AND sender REGEXP(REPLACE(value, '*', '.+'))) IS NULL
GROUP BY rcpt')
for record in records:
attrs = ''