Update EmailMessage to leverage Django's mail header handling.

Review Request #11680 — Created June 25, 2021 and submitted

Information

Djblets
release-2.x

Reviewers

Our EmailMessage class maintains its own list of headers to add during
message building. We were using add_header() to do this, which
technically works, but bypasses Django's custom logic for handling
various encoding and address-related header situations.

This change switches to the preferred method, msg[header] = ..., and
adds several new unit tests to check headers when Unicode characters are
involved.

Unit tests pass on Python 2 and 3.

Summary ID
Update EmailMessage to leverage Django's mail header handling.
Our `EmailMessage` class maintains its own list of headers to add during message building. We were using `add_header()` to do this, which technically works, but bypasses Django's custom logic for handling various encoding and address-related header situations. This change switches to the preferred method, `msg[header] = ...`, and adds several new unit tests to check headers when Unicode characters are involved.
73e1a1e3bb5e62c83e9c2f680ba312ec71a7beb6
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.x (fc39834)