mirror of
https://github.com/simple-login/app.git
synced 2024-09-30 05:31:30 +02:00
Merge pull request #191 from SibrenVasse/spam
Also enable spam check when pgp is enabled
This commit is contained in:
commit
ec8f46f01a
@ -366,17 +366,6 @@ def handle_forward(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, s
|
|||||||
db.session.commit()
|
db.session.commit()
|
||||||
return True, "250 Message accepted for delivery"
|
return True, "250 Message accepted for delivery"
|
||||||
|
|
||||||
spam_check = True
|
|
||||||
|
|
||||||
# create PGP email if needed
|
|
||||||
if mailbox.pgp_finger_print and user.is_premium():
|
|
||||||
LOG.d("Encrypt message using mailbox %s", mailbox)
|
|
||||||
msg = prepare_pgp_message(msg, mailbox.pgp_finger_print)
|
|
||||||
|
|
||||||
# no need to spam check for encrypted message
|
|
||||||
spam_check = False
|
|
||||||
|
|
||||||
if spam_check:
|
|
||||||
is_spam, spam_status = get_spam_info(msg)
|
is_spam, spam_status = get_spam_info(msg)
|
||||||
if is_spam:
|
if is_spam:
|
||||||
LOG.warning("Email detected as spam. Alias: %s, from: %s", alias, contact)
|
LOG.warning("Email detected as spam. Alias: %s, from: %s", alias, contact)
|
||||||
@ -386,6 +375,11 @@ def handle_forward(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, s
|
|||||||
handle_spam(contact, alias, msg, user, mailbox_email, email_log)
|
handle_spam(contact, alias, msg, user, mailbox_email, email_log)
|
||||||
return False, "550 SL E1"
|
return False, "550 SL E1"
|
||||||
|
|
||||||
|
# create PGP email if needed
|
||||||
|
if mailbox.pgp_finger_print and user.is_premium():
|
||||||
|
LOG.d("Encrypt message using mailbox %s", mailbox)
|
||||||
|
msg = prepare_pgp_message(msg, mailbox.pgp_finger_print)
|
||||||
|
|
||||||
# add custom header
|
# add custom header
|
||||||
add_or_replace_header(msg, "X-SimpleLogin-Type", "Forward")
|
add_or_replace_header(msg, "X-SimpleLogin-Type", "Forward")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user