-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Description
let base64Encoded = signedData.base64EncodedString()
let gpgAttachment = Attachment(
data: Data(base64Encoded.utf8),
mime: "application/octet-stream", // or "application/octet-stream"
name: "\(title).pdf.gpg",
inline: false,
additionalHeaders: [
"Content-Transfer-Encoding": "base64"
]
)
let mail = Mail(
from: from,
to: [toUser],
subject: emailSubject,
text: "Please use a HTML ready Mail Client to view the email.",
attachments: [
Attachment(
htmlContent: htmlContent,
additionalHeaders: ["Content-Type": "text/html; charset=utf-8"]
),
gpgAttachment
]
)
The above works:
- HTML in email will not be broken
- file will be attached
BUT:
since file is a SIGNED file (thus a .gpg file), the above code will BREAK the signature as we encode it to utf8 and that messes the signature up
Thus:
let gpgAttachment = Attachment(
data: signedData,
mime: "application/octet-stream", // or "application/octet-stream"
name: "\(title).pdf.gpg",
inline: false,
additionalHeaders: [
"Content-Transfer-Encoding": "base64"
]
)
File will now validate correctly (PGP signature valid) but this will mess up the HTML part of the mail rendering it gibberish like v�-蕳《ia秈q歒���m��鹈7⒏?走}�etc etc
There must be something I miss.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels