lassedev
lassedev

Reputation: 337

mailkit.net/mimekit.net Get original Message from Multipart/Signed Message

I have a Multipart/Signed message and can verify it. Now I need to access the original Message to be able to access the attachments. Is there a way to access the original Message after the Verification happened and how would you do it using mailkit.net/mimekit.net?

Upvotes: 0

Views: 255

Answers (1)

jstedfast
jstedfast

Reputation: 38538

The original message body is just the first child of the MultipartSigned part.

I'm presuming here that the multipart/signed part is the toplevel part of the message (which is typically the case):

var body = message.Body;

if (body is MultipartSigned signed) {
    // do your verification as you've already done...

    // update 'body' to point to the original message body
    body = signed[0];
}

// process 'body' as if it was the body of the message

Upvotes: 1

Related Questions