From 5c8d31111c7f754de1db4583a79b31ea882c6748 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Wed, 16 Sep 2020 17:24:42 +0200 Subject: [PATCH] add contact to handle_unknown_mailbox logging --- email_handler.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/email_handler.py b/email_handler.py index 49b88af3..ced9543b 100644 --- a/email_handler.py +++ b/email_handler.py @@ -745,7 +745,7 @@ async def handle_reply(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (boo mailbox = alias.mailbox else: # only mailbox can send email to the reply-email - handle_unknown_mailbox(envelope, msg, reply_email, user, alias) + handle_unknown_mailbox(envelope, msg, reply_email, user, alias, contact) return False, "550 SL E7" if ENFORCE_SPF and mailbox.force_spf and not alias.disable_email_spoofing_check: @@ -978,15 +978,18 @@ def spf_pass( return True -def handle_unknown_mailbox(envelope, msg, reply_email: str, user: User, alias: Alias): +def handle_unknown_mailbox( + envelope, msg, reply_email: str, user: User, alias: Alias, contact: Contact +): LOG.warning( f"Reply email can only be used by mailbox. " - f"Actual mail_from: %s. msg from header: %s, reverse-alias %s, %s %s", + f"Actual mail_from: %s. msg from header: %s, reverse-alias %s, %s %s %s", envelope.mail_from, msg["From"], reply_email, alias, user, + contact, ) send_email_with_rate_control(