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

Answered by Engineer in 679056022

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.

Accepted Answer

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.

MailKit for macOS 12 access to attachments
 
 
Q