Fix unbound variable usage

This commit is contained in:
Drew DeVault 2019-04-29 14:57:57 -04:00
parent 9a5d256e53
commit 16530ada56
1 changed files with 3 additions and 3 deletions

View File

@ -99,6 +99,9 @@ class MailHandler:
async def handle_DATA(self, server, session, envelope):
address = envelope.rcpt_tos[0]
mail = email.message_from_bytes(envelope.content,
policy=email.policy.SMTP)
_from = parseaddr(mail["From"])
sender = User.query.filter(User.email == _from[1]).one_or_none()
@ -111,9 +114,6 @@ class MailHandler:
print("Rejected, insufficient permissions")
return "550 You do not have permission to post on this tracker."
mail = email.message_from_bytes(envelope.content,
policy=email.policy.SMTP)
body = None
for part in mail.walk():
if part.is_multipart():