MailCore / mailcore2

MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP. The API has been redesigned from ground up.
Other
2.6k stars 623 forks source link

No default MCOHTMLRendererIMAPDelegate is provided in the library #1870

Closed Prakhar-Srivastava closed 4 years ago

Prakhar-Srivastava commented 4 years ago

Recently I've been trying to use MailCore2 inside my react-native app to read mails, so I made a RCTBridge in Swift for it, and I want to return a simple html string of fetched messages... I have successfully fetched messages of type [MCOIMAPMessage] and now I want to map over this array to convert it to html string with the following code

let msgs = (ret.value(forKey: "messages") as! [MCOIMAPMessage]).map{ [ "html": $0.htmlRendering(withFolder: folder as String, delegate: MCOHTMLRendererIMAPDelegate()) as NSString,
] as NSDictionary }

Obviously it gives an error, can somebody please tell me the right way to do it...? Or at least tell me how to implement a MCOHTMLRendererIMAPDelegate

haithngn commented 4 years ago

@Prakhar-Srivastava why don't you implement a MCOHTMLRendererIMAPDelegate then write the HTML into a file on a directory instead of passing the HTML string to React-Native you could pass the path of the HTML file.