mirror of
https://github.com/simple-login/app.git
synced 2024-09-20 15:05:59 +08:00
add warning for when postfix queue id can't be retrieved
This commit is contained in:
parent
b84eb13ab5
commit
58a1d6e783
|
@ -1547,14 +1547,16 @@ def handle(envelope: Envelope) -> str:
|
||||||
envelope.mail_from = mail_from
|
envelope.mail_from = mail_from
|
||||||
envelope.rcpt_tos = rcpt_tos
|
envelope.rcpt_tos = rcpt_tos
|
||||||
|
|
||||||
if should_ignore(mail_from, rcpt_tos):
|
|
||||||
LOG.e("Ignore email mail_from=%s rcpt_to=%s", mail_from, rcpt_tos)
|
|
||||||
return "250 email can't be sent from a reverse-alias"
|
|
||||||
|
|
||||||
msg = email.message_from_bytes(envelope.original_content)
|
msg = email.message_from_bytes(envelope.original_content)
|
||||||
postfix_queue_id = get_queue_id(msg)
|
postfix_queue_id = get_queue_id(msg)
|
||||||
if postfix_queue_id:
|
if postfix_queue_id:
|
||||||
set_message_id(postfix_queue_id)
|
set_message_id(postfix_queue_id)
|
||||||
|
else:
|
||||||
|
LOG.w("Cannot parse Postfix queue ID from %s", msg["Received"])
|
||||||
|
|
||||||
|
if should_ignore(mail_from, rcpt_tos):
|
||||||
|
LOG.e("Ignore email mail_from=%s rcpt_to=%s", mail_from, rcpt_tos)
|
||||||
|
return "250 email can't be sent from a reverse-alias"
|
||||||
|
|
||||||
# sanitize email headers
|
# sanitize email headers
|
||||||
sanitize_header(msg, "from")
|
sanitize_header(msg, "from")
|
||||||
|
|
Loading…
Reference in a new issue