From f53e8c1af87369a4e942fcc27770676c1c115aa2 Mon Sep 17 00:00:00 2001 From: Son Nguyen Kim Date: Fri, 10 Sep 2021 17:48:36 +0200 Subject: [PATCH] refactor --- email_handler.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/email_handler.py b/email_handler.py index c4ce638f..e7f1dcbb 100644 --- a/email_handler.py +++ b/email_handler.py @@ -549,14 +549,17 @@ def handle_forward(envelope, msg: Message, rcpt_to: str) -> List[Tuple[bool, str is_success indicates whether an email has been delivered and smtp_status is the SMTP Status ("250 Message accepted", "550 Non-existent email address", etc) """ - address = rcpt_to # alias@SL + alias_address = rcpt_to # alias@SL - alias = Alias.get_by(email=address) + alias = Alias.get_by(email=alias_address) if not alias: - LOG.d("alias %s not exist. Try to see if it can be created on the fly", address) - alias = try_auto_create(address) + LOG.d( + "alias %s not exist. Try to see if it can be created on the fly", + alias_address, + ) + alias = try_auto_create(alias_address) if not alias: - LOG.d("alias %s cannot be created on-the-fly, return 550", address) + LOG.d("alias %s cannot be created on-the-fly, return 550", alias_address) if should_ignore_bounce(envelope.mail_from): return [(True, status.E207)] else: