Fetch an email body in mailcore2 OSX with swift

1.1k Views Asked by At

I try use this class: MCOIMAPFetchContentOperation for fetch body mail. But i don't know how invoke her in swift and i don't know the arguments who are necessary.

Description of the class is: "This class implements an operation to fetch the content of a message. It can be a part or a full message."

Can you help me please !

1

There are 1 best solutions below

0
HungryArthur On

Your question is a little vague but I assume to mean something like this :

func loadMsg(msg: MCOIMAPMessage, folder: String) {

    let operation: MCOIMAPFetchContentOperation = session.fetchMessageByUIDOperationWithFolder(folder, uid: msg.uid)

    operation.start { (error:NSError!, data:NSData!) -> Void in
        let messageParser: MCOMessageParser = MCOMessageParser(data: data)
        let msgHTMLBody: NSString = messageParser.htmlBodyRendering()

        print ("HTML: \(msgHTMLBody)")
    }      

}