deltachat::decrypt

Function get_mixed_up_mime

source
fn get_mixed_up_mime<'a, 'b>(
    mail: &'a ParsedMail<'b>,
) -> Option<&'a ParsedMail<'b>>
Expand description

Returns a reference to the encrypted payload of a “Mixed Up” message.

According to RFC 3156 encrypted messages should have multipart/encrypted MIME type and two parts, but Microsoft Exchange and ProtonMail IMAP/SMTP Bridge are known to mangle this structure by changing the type to multipart/mixed and prepending an empty part at the start.

ProtonMail IMAP/SMTP Bridge prepends a part literally saying “Empty Message”, so we don’t check its contents at all, checking only for text/plain type.

Returns None if the message is not a “Mixed Up” message.