mirror of
https://github.com/simple-login/app.git
synced 2025-02-23 23:34:05 +08:00
handle both emails with reply+ and ra+ prefix
This commit is contained in:
parent
8c3834c957
commit
46b0872710
1 changed files with 15 additions and 12 deletions
|
@ -79,19 +79,22 @@ class MailHandler:
|
|||
smtp = SMTP(POSTFIX_SERVER, 25)
|
||||
msg = Parser(policy=SMTPUTF8).parsestr(message_data)
|
||||
|
||||
if not envelope.rcpt_tos[0].startswith("reply+"): # Forward case
|
||||
LOG.debug("Forward phase")
|
||||
app = new_app()
|
||||
|
||||
with app.app_context():
|
||||
return self.handle_forward(envelope, smtp, msg)
|
||||
|
||||
else:
|
||||
# Reply case
|
||||
# reply+ or ra+ (reverse-alias) prefix
|
||||
if envelope.rcpt_tos[0].startswith("reply+") or envelope.rcpt_tos[0].startswith(
|
||||
"ra+"
|
||||
):
|
||||
LOG.debug("Reply phase")
|
||||
app = new_app()
|
||||
|
||||
with app.app_context():
|
||||
return self.handle_reply(envelope, smtp, msg)
|
||||
else: # Forward case
|
||||
LOG.debug("Forward phase")
|
||||
app = new_app()
|
||||
|
||||
with app.app_context():
|
||||
return self.handle_forward(envelope, smtp, msg)
|
||||
|
||||
def handle_forward(self, envelope, smtp, msg: EmailMessage) -> str:
|
||||
"""return *status_code message*"""
|
||||
|
|
Loading…
Reference in a new issue