Prior to May 13, 2024, this assumed the value was previously encoded. This worked most the time but also left open the possibility of incorrectly encoded values, including the possibility of injecting inappropriate headers.
Since May 13, 2024, it now encodes the header content internally. You should NOT pass pre-encoded values to this function anymore.
It also would previously allow you to set repeated headers like Subject or To. These now throw exceptions.
It previously also allowed duplicate headers. Adding the same thing twice will now silently overwrite the old value instead.
Adds a custom header to the message. The header name should not include a colon and must not duplicate a header set elsewhere in the class; for example, do not use this to set To, and instead use the to field.
Setting the same header multiple times will overwrite the old value. It will not set duplicate headers and does not retain the specific order of which you added headers.