SMTP relay corrupts 8-bit message content #4

Closed
opened 2026-06-17 17:12:09 +01:00 by lyrathorpe · 0 comments
Owner

SMTPProxyHandler.send_message (proxy_server.py:349) does:

message = data.decode("utf-8", errors="replace")

errors="replace" destroys any non-UTF-8 byte, damaging 8-bit bodies and attachments. smtplib.sendmail accepts bytes directly.

Fix:

  • Pass the raw envelope.content bytes to smtp.sendmail without decoding.

Acceptance:

  • A message with non-UTF-8 / 8-bit content is relayed byte-for-byte.
SMTPProxyHandler.send_message (proxy_server.py:349) does: message = data.decode("utf-8", errors="replace") errors="replace" destroys any non-UTF-8 byte, damaging 8-bit bodies and attachments. smtplib.sendmail accepts bytes directly. Fix: - Pass the raw envelope.content bytes to smtp.sendmail without decoding. Acceptance: - A message with non-UTF-8 / 8-bit content is relayed byte-for-byte.
lyrathorpe added the bug label 2026-06-17 17:12:09 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lyrathorpe/legacy-email-proxy#4