Hi,
I am trying to build a Mail 'action' extension, and want to access the email body and parse it for specific content. Not sure how to go about converting the 'rawData' that comes in the MEMessage
into something that I can read.
Here's how I access the rawData property:
func decideAction(for message: MEMessage, completionHandler: @escaping (MEMessageActionDecision?) -> Void) {
var action: MEMessageActionDecision? = nil
if let messageData = message.rawData {
print("messageData = \(messageData)")
// what to do here??
} else {
action = MEMessageActionDecision.invokeAgainWithBody
}
return action
}
The documentation just says this is 'unprocessed data':
The content is available after MailKit downloads the message. MailKit provides the content as unprocessed data. For details about the format of the data, see RFC 2822.
But I'm not sure what I'm supposed to do to go about converting the unprocessed 'data' into something that is accessible and useful to my app.
Let me know if you have any thoughts or recommendations