diff --git a/filter-rules.py b/filter-rules.py index 290cf98..66ef6c6 100644 --- a/filter-rules.py +++ b/filter-rules.py @@ -41,6 +41,8 @@ BLOCK_KEYWORDS = [ ] BLOCK_DOMAINS = [ + 'customeriomail.com', + 'mailgun.net' ] ALLOW = [ @@ -134,14 +136,15 @@ def filter_message(self, message): # junk messages from blocked domains for domain in BLOCK_DOMAINS: - if domain in message_from: + if domain in normalized_from: is_spam = True break - if search_headers(domain): + if search_headers(domain, headers): is_spam = True break if is_spam: self._log_result(message, 'junking spam from blocked domain') + message.move(self._folders['Junk Email']) return # junk known spam headers @@ -175,6 +178,5 @@ def search_headers(search, headers): is_found = False for header in headers: for val in header.values(): - print(f"is {search} in {val}?") if search in val: return True