Browse Source

Set X-SimpleLogin-Envelope-From header in forward phase

Son NK 4 years ago
parent
commit
aa1cac521b
1 changed files with 2 additions and 0 deletions
  1. 2 0
      email_handler.py

+ 2 - 0
email_handler.py

@@ -125,6 +125,7 @@ _IP_HEADER = "X-SimpleLogin-Client-IP"
 _MAILBOX_ID_HEADER = "X-SimpleLogin-Mailbox-ID"
 _EMAIL_LOG_ID_HEADER = "X-SimpleLogin-EmailLog-ID"
 _MESSAGE_ID = "Message-ID"
+_ENVELOPE_FROM = "X-SimpleLogin-Envelope-From"
 
 
 # fix the database connection leak issue
@@ -650,6 +651,7 @@ def forward_email_to_mailbox(
     add_or_replace_header(msg, _MAILBOX_ID_HEADER, str(mailbox.id))
     add_or_replace_header(msg, _EMAIL_LOG_ID_HEADER, str(email_log.id))
     add_or_replace_header(msg, _MESSAGE_ID, make_msgid(str(email_log.id), EMAIL_DOMAIN))
+    add_or_replace_header(msg, _ENVELOPE_FROM, envelope.mail_from)
 
     # change the from header so the sender comes from @SL
     # so it can pass DMARC check