checks for domain & mbox status

This commit is contained in:
Matthew Saunders Brown 2021-11-20 15:32:39 -08:00
parent f4ee4773ff
commit 75489ce102

View File

@ -725,7 +725,7 @@ junk_filter:
local_part_suffix = +* local_part_suffix = +*
local_part_suffix_optional = true local_part_suffix_optional = true
condition = ${if eq {$header_X-Junk-Flag:}{YES}} condition = ${if eq {$header_X-Junk-Flag:}{YES}}
condition = ${lookup mysql{SELECT vm_mboxes.id FROM vm_domains, vm_mboxes WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id}} condition = ${lookup mysql{SELECT vm_mboxes.id FROM vm_domains, vm_mboxes WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id AND vm_domains.status = '1' AND vm_mboxes.status = '1'}}
transport = junk_delivery transport = junk_delivery
spam_filter: spam_filter:
@ -737,7 +737,7 @@ spam_filter:
{ eq {$received_protocol}{spam-scanned}} \ { eq {$received_protocol}{spam-scanned}} \
{ eq {$header_X-Spam-Flag:}{YES}} \ { eq {$header_X-Spam-Flag:}{YES}} \
} {yes}{no}} } {yes}{no}}
condition = ${lookup mysql{SELECT vm_mboxes.id FROM vm_domains, vm_mboxes WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id}} condition = ${lookup mysql{SELECT vm_mboxes.id FROM vm_domains, vm_mboxes WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id AND vm_domains.status = '1' AND vm_mboxes.status = '1'}}
transport = junk_delivery transport = junk_delivery
virtual_vacation: virtual_vacation:
@ -748,7 +748,7 @@ virtual_vacation:
{ !eq {$received_protocol}{spam-scanned}} \ { !eq {$received_protocol}{spam-scanned}} \
{!match {$h_precedence:} {(?i)junk|bulk|list}} \ {!match {$h_precedence:} {(?i)junk|bulk|list}} \
{!eq {$sender_address} {}} \ {!eq {$sender_address} {}} \
{ eq {${lookup mysql{SELECT vm_autoresponders.mode FROM vm_domains, vm_mboxes, vm_autoresponders WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id AND vm_autoresponders.mbox_id = vm_mboxes.id AND vm_autoresponders.status='1'}{$value}fail}}{Vacation}} \ { eq {${lookup mysql{SELECT vm_autoresponders.mode FROM vm_domains, vm_mboxes, vm_autoresponders WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id AND vm_autoresponders.mbox_id = vm_mboxes.id AND vm_domains.status = '1' AND vm_mboxes.status = '1' AND vm_autoresponders.status = '1'}{$value}fail}}{Vacation}} \
} {yes} {no}} } {yes} {no}}
# add options for start & end date fields # add options for start & end date fields
no_expn no_expn
@ -774,7 +774,7 @@ virtual_autoresponder:
{ !eq {$received_protocol}{spam-scanned}} \ { !eq {$received_protocol}{spam-scanned}} \
{!match {$h_precedence:} {(?i)junk|bulk|list}} \ {!match {$h_precedence:} {(?i)junk|bulk|list}} \
{!eq {$sender_address} {}} \ {!eq {$sender_address} {}} \
{ eq {${lookup mysql{SELECT vm_autoresponders.mode FROM vm_domains, vm_mboxes, vm_autoresponders WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id AND vm_autoresponders.mbox_id = vm_mboxes.id AND vm_autoresponders.status='1'}{$value}fail}}{Autoresponder} } \ { eq {${lookup mysql{SELECT vm_autoresponders.mode FROM vm_domains, vm_mboxes, vm_autoresponders WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id AND vm_autoresponders.mbox_id = vm_mboxes.id AND vm_domains.status = '1' AND vm_mboxes.status = '1' AND vm_autoresponders.status = '1'}{$value}fail}}{Autoresponder} } \
} {yes} {no}} } {yes} {no}}
# add options for start & end date fields # add options for start & end date fields
no_expn no_expn
@ -795,8 +795,8 @@ virtual_forward:
local_part_suffix = +* local_part_suffix = +*
local_part_suffix_optional = true local_part_suffix_optional = true
condition = ${if !eq {$received_protocol}{spam-scanned}} condition = ${if !eq {$received_protocol}{spam-scanned}}
data = ${lookup mysql{SELECT vm_forwards.forward_to FROM vm_domains, vm_mboxes, vm_forwards WHERE vm_domains.domain='${domain}' AND vm_domains.id = vm_mboxes.domain_id AND vm_mboxes.mbox='${local_part}' AND vm_mboxes.id=vm_forwards.mbox_id }} data = ${lookup mysql{SELECT vm_forwards.forward_to FROM vm_domains, vm_mboxes, vm_forwards WHERE vm_domains.domain='${domain}' AND vm_domains.id = vm_mboxes.domain_id AND vm_mboxes.mbox='${local_part}' AND vm_mboxes.id=vm_forwards.mbox_id AND vm_domains.status = '1' AND vm_mboxes.status = '1' }}
unseen = ${lookup mysql{SELECT vm_forwards.id FROM vm_domains, vm_mboxes, vm_forwards WHERE vm_domains.domain='${domain}' AND vm_domains.id = vm_mboxes.domain_id AND vm_mboxes.mbox='${local_part}' AND vm_mboxes.id=vm_forwards.mbox_id AND vm_forwards.save_local='1'}{true}{false}} unseen = ${lookup mysql{SELECT vm_forwards.id FROM vm_domains, vm_mboxes, vm_forwards WHERE vm_domains.domain='${domain}' AND vm_domains.id = vm_mboxes.domain_id AND vm_mboxes.mbox='${local_part}' AND vm_mboxes.id=vm_forwards.mbox_id AND vm_domains.status = '1' AND vm_mboxes.status = '1' AND vm_forwards.save_local='1'}{true}{false}}
virtual_alias: virtual_alias:
driver = redirect driver = redirect
@ -804,7 +804,7 @@ virtual_alias:
local_part_suffix = +* local_part_suffix = +*
local_part_suffix_optional = true local_part_suffix_optional = true
condition = ${if !eq {$received_protocol}{spam-scanned}} condition = ${if !eq {$received_protocol}{spam-scanned}}
data = ${lookup mysql{SELECT CONCAT(vm_mboxes.mbox,'@${domain}') FROM vm_aliases, vm_mboxes, vm_domains WHERE vm_aliases.alias='${local_part}' AND vm_aliases.mbox_id = vm_mboxes.id AND vm_mboxes.domain_id = vm_domains.id AND vm_domains.domain='${domain}'}} data = ${lookup mysql{SELECT CONCAT(vm_mboxes.mbox,'@${domain}') FROM vm_aliases, vm_mboxes, vm_domains WHERE vm_aliases.alias='${local_part}' AND vm_aliases.mbox_id = vm_mboxes.id AND vm_mboxes.domain_id = vm_domains.id AND vm_domains.domain='${domain}' AND vm_domains.status = '1' AND vm_mboxes.status = '1'}}
spamcheck_router: spamcheck_router:
driver = accept driver = accept
@ -817,7 +817,7 @@ spamcheck_router:
{ < {$message_size}{512k}} \ { < {$message_size}{512k}} \
{ !eq {$header_X-Junk-Flag:}{YES}} \ { !eq {$header_X-Junk-Flag:}{YES}} \
{ !eq {$header_X-Whitelist-Flag:}{YES}} \ { !eq {$header_X-Whitelist-Flag:}{YES}} \
{ eq {${lookup mysql{SELECT vm_mboxes.status FROM vm_domains, vm_mboxes WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id}{$value}fail}}{1} } \ { eq {${lookup mysql{SELECT vm_mboxes.status FROM vm_domains, vm_mboxes WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id AND vm_domains.status = '1'}{$value}fail}}{1} } \
} {yes} {no}} } {yes} {no}}
# check domain & mbox 'status'? # check domain & mbox 'status'?
# Check for other headers too? Blacklist, SPF, DKIM failers go directly to Spam folder without spam scan??? - actually they should go to spam folder before this router is hit? # Check for other headers too? Blacklist, SPF, DKIM failers go directly to Spam folder without spam scan??? - actually they should go to spam folder before this router is hit?
@ -829,7 +829,7 @@ user_filter:
domains = +local_domains domains = +local_domains
local_part_suffix = +* local_part_suffix = +*
local_part_suffix_optional = true local_part_suffix_optional = true
data = ${lookup mysql{SELECT vm_filters.filter FROM vm_domains, vm_mboxes, vm_filters WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id AND vm_mboxes.id = vm_filters.mbox_id }} data = ${lookup mysql{SELECT vm_filters.filter FROM vm_domains, vm_mboxes, vm_filters WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id AND vm_mboxes.id = vm_filters.mbox_id AND vm_domains.status = '1' AND vm_mboxes.status = '1' }}
user = vmail user = vmail
no_verify no_verify
no_expn no_expn
@ -846,7 +846,7 @@ lmtp_localuser:
domains = +local_domains domains = +local_domains
local_part_suffix = +* local_part_suffix = +*
local_part_suffix_optional = true local_part_suffix_optional = true
condition = ${lookup mysql{SELECT vm_mboxes.id FROM vm_domains, vm_mboxes WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id AND vm_mboxes.status = '1'}} condition = ${lookup mysql{SELECT vm_mboxes.id FROM vm_domains, vm_mboxes WHERE vm_domains.domain='${domain}' AND vm_mboxes.mbox='${local_part}' AND vm_domains.id = vm_mboxes.domain_id AND vm_domains.status = '1' AND vm_mboxes.status = '1'}}
# add checks to query for domain & mbox being active # add checks to query for domain & mbox being active
transport = dovecot_lmtp transport = dovecot_lmtp
cannot_route_message = Unknown user cannot_route_message = Unknown user