MailKit for macOS 12 access to attachments

Hello,

MailKit for macOS 12 looks great, but it is possible to have access to incoming/outgoing email attachments? For the moment MEMessage does not give access to such properties. Or any other ways to achieve this? (like some data parsing)?

Thank you

Accepted Reply

You are able to receive the full body data of the message by returning the invokeAgainWithBody decision when your extension is first called for a decision for the message. Your extension will be invoked again for this message once the body is downloaded. At this point the rawData property of the MEMessage will contain the full RFC822 message data. Your extension can parse this data to separate out the attachments. Your extension will need to be able to parse the MIME data. Your can write your own MIME parser or use a 3rd party MIME parser.

Replies

You are able to receive the full body data of the message by returning the invokeAgainWithBody decision when your extension is first called for a decision for the message. Your extension will be invoked again for this message once the body is downloaded. At this point the rawData property of the MEMessage will contain the full RFC822 message data. Your extension can parse this data to separate out the attachments. Your extension will need to be able to parse the MIME data. Your can write your own MIME parser or use a 3rd party MIME parser.

You can see an example implementation of invokeAgainWithBody in Build Mail App Extensions.

  • Hello, I tried the example but message.rawData does not include the message body. It only includes the headers. I use build 13A5212g.

  • +1 message.rawData not including message body, only the headers on my end.

  • According to this thread: https://developer.apple.com/forums/thread/684215

    I believe it has been resolved in the latest build 21A5294g

Add a Comment