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?
-
—
PuzzleMaster
Add a CommentMaybe I should rephrase the question. In PGP/GPG the signature and the encrypted message are usually embedded as attachments in the email. This way, a recipient that doesn't have PGP/GPG installed (anymore) will see an empty email with an
encrypted.ascfile instead of the encrypted gibberish in the body of the email.I'd like to do the same as PGP/GPG and store the signature and the ciphertext in an attachment. How do I do that?