mirror of
https://github.com/simple-login/app.git
synced 2025-02-24 15:53:22 +08:00
only run spam check in email handler if ENABLE_SPAM_ASSASSIN is enabled
This commit is contained in:
parent
2270ccf35d
commit
365c11f926
1 changed files with 76 additions and 71 deletions
|
@ -72,6 +72,7 @@ from app.config import (
|
||||||
BOUNCE_SUFFIX,
|
BOUNCE_SUFFIX,
|
||||||
TRANSACTIONAL_BOUNCE_PREFIX,
|
TRANSACTIONAL_BOUNCE_PREFIX,
|
||||||
TRANSACTIONAL_BOUNCE_SUFFIX,
|
TRANSACTIONAL_BOUNCE_SUFFIX,
|
||||||
|
ENABLE_SPAM_ASSASSIN,
|
||||||
)
|
)
|
||||||
from app.email.spam import get_spam_score
|
from app.email.spam import get_spam_score
|
||||||
from app.email_utils import (
|
from app.email_utils import (
|
||||||
|
@ -594,6 +595,7 @@ def forward_email_to_mailbox(
|
||||||
contact_id=contact.id, user_id=user.id, mailbox_id=mailbox.id, commit=True
|
contact_id=contact.id, user_id=user.id, mailbox_id=mailbox.id, commit=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if ENABLE_SPAM_ASSASSIN:
|
||||||
# Spam check
|
# Spam check
|
||||||
spam_status = ""
|
spam_status = ""
|
||||||
is_spam = False
|
is_spam = False
|
||||||
|
@ -818,6 +820,7 @@ def handle_reply(envelope, msg: Message, rcpt_to: str) -> (bool, str):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Spam check
|
# Spam check
|
||||||
|
if ENABLE_SPAM_ASSASSIN:
|
||||||
spam_status = ""
|
spam_status = ""
|
||||||
is_spam = False
|
is_spam = False
|
||||||
|
|
||||||
|
@ -839,7 +842,9 @@ def handle_reply(envelope, msg: Message, rcpt_to: str) -> (bool, str):
|
||||||
# only set the spam report for spam
|
# only set the spam report for spam
|
||||||
email_log.spam_report = spam_report
|
email_log.spam_report = spam_report
|
||||||
else:
|
else:
|
||||||
is_spam, spam_status = get_spam_info(msg, max_score=MAX_REPLY_PHASE_SPAM_SCORE)
|
is_spam, spam_status = get_spam_info(
|
||||||
|
msg, max_score=MAX_REPLY_PHASE_SPAM_SCORE
|
||||||
|
)
|
||||||
|
|
||||||
if is_spam:
|
if is_spam:
|
||||||
LOG.w(
|
LOG.w(
|
||||||
|
|
Loading…
Reference in a new issue