I am very new to Swift programming. But for testing I was able to access the email content with session.composeContext. I did not fully understand the reason. rawData is sometimes empty.
import MailKit
class ComposeSessionHandler: NSObject, MEComposeSessionHandler {
func mailComposeSessionDidBegin(_ session: MEComposeSession) {
// Perform any setup necessary for handling the compose session.
if let data = session.composeContext.originalMessage?.rawData as? Data {
let dataStr = String(data: data, encoding: .utf8)
print(dataStr)
}
}
// ...
}