It seems that the mail app sets its mail headers after additionalHeaders(for:)
is called, overwriting standard headers set by the extension, such as Content-Type
.
It also seems the Mail app decides whether an email is of content type text/plain
or multipart/alternative; boundary="Apple-Mail=[...]"
based on the user input. If the user only inputs plain text (i.e. using no font formatting options or adding an attachment) then Content-Type
will always default to text/plain
.
This causes an issue in encode(_:, composeContext:)
if the signature should be included as an attachment. First of all, it seems impossible to force Mail to set Content-Type
to multipart/alternative
and even if the message is set to multipart/alternative
(e.g. b/c the user made text bold), the ecode
method doesn't know the boundary string set by Apple mail (Apple-Mail=[hash]
).
Is there a way to create an attachment in encode
?