mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2025-01-26 05:27:29 +02:00
Quarantine notifications - exclude blacklisted sender (#3446)
Final version, fixed syntax Signed-off-by: Kristián Feldsam <feldsam@gmail.com>
This commit is contained in:
parent
5944595be3
commit
fe19bb7d94
@ -97,7 +97,13 @@ def notify_rcpt(rcpt, msg_count, quarantine_acl):
|
|||||||
print('%s' % (ex))
|
print('%s' % (ex))
|
||||||
time.sleep(3)
|
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:
|
for record in records:
|
||||||
attrs = ''
|
attrs = ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user