Preserve List-ID (#2420)

This commit is contained in:
Adrià Casajús 2025-03-19 15:05:25 +01:00 committed by GitHub
parent 3962ab5fb0
commit bb4d51d6e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 0 deletions

View file

@ -19,6 +19,7 @@ CC = "Cc"
DKIM_SIGNATURE = "DKIM-Signature"
X_SPAM_STATUS = "X-Spam-Status"
LIST_UNSUBSCRIBE = "List-Unsubscribe"
LIST_ID = "List-Id"
LIST_UNSUBSCRIBE_POST = "List-Unsubscribe-Post"
RETURN_PATH = "Return-Path"
AUTHENTICATION_RESULTS = "Authentication-Results"
@ -40,6 +41,7 @@ SL_ENVELOPE_TO = "X-SimpleLogin-Envelope-To"
SL_CLIENT_IP = "X-SimpleLogin-Client-IP"
SL_ORIGINAL_LIST_UNSUBSCRIBE = "X-SimpleLogin-Original-List-Unsubscribe"
SL_ORIGINAL_LIST_UNSUBSCRIBE_POST = "X-SimpleLogin-Original-List-Unsubscribe-Post"
SL_ORIGINAL_LIST_ID = "X-SimpleLogin-Original-List-Id"
# to let Rspamd know that the message should be signed
SL_WANT_SIGNING = "X-SimpleLogin-Want-Signing"

View file

@ -144,6 +144,12 @@ class UnsubscribeGenerator:
add_or_replace_header(
message, headers.SL_ORIGINAL_LIST_UNSUBSCRIBE_POST, unsubscribe_data
)
unsubscribe_data = message[headers.LIST_ID]
if unsubscribe_data:
add_or_replace_header(
message, headers.SL_ORIGINAL_LIST_ID, unsubscribe_data
)
delete_header(message, headers.LIST_ID)
for header in original_unsub_proxied:
add_or_replace_header(
message, f"X-SL-Proxy-{header}", original_unsub_proxied[header]

View file

@ -839,6 +839,7 @@ def forward_email_to_mailbox(
headers.IN_REPLY_TO,
headers.SL_QUEUE_ID,
headers.LIST_UNSUBSCRIBE,
headers.LIST_ID,
headers.LIST_UNSUBSCRIBE_POST,
] + headers.MIME_HEADERS
if user.include_header_email_header: