viewing mime email (or better yet, a full-blown IMAP client!)

Is anyone aware of a product (with source) or sample code for reliably displaying the content of MIME email, possibly via an HTMLviewer (so that it would also work in a web app)?

I have code that seems to work for pulling down email via IMAP and displaying simple text or HTML messages, but it’s ugly and complex and still fails to display more messages than it works with…

Ideally, I’d love to find a fully function email client built in Xojo that downloads email to a local DB and also allows sending…

did you try mbs plugins?

I have the MBS plugins and use them for a lot of things–but unless I overlooked something (which is very possible given how little sleep I’m running on right now!), there’s not something there that can act as MIME mail viewer in a web app running on a Windows server? Maybe in a native Windows app?

If anyone knows then @Beatrix Willius - she is THE email-guru here

In addition to what was already suggested, here are some more links that might help as a starting point for you:

MBS Plugin has curl functions for IMAP and to parse the emails. You could try examples.

I’m using MBS Curl for pulling messages down via IMAP–it’s just displaying them cleanly that I’m having problems with (all the various MIME parts and attachments). Christian, what do you mean by “parsely NUG emails?”

Here are the email parser classes:

incorrect spellchecking correction fixed.

Parsing emails is a lot of interpretation. The Chilkat plugin has a method to parse the simpler mails but this fails as soon are you get multipart emails. I haven’t looked at the CURL plugin from MBS in depth. A spot check showed that it couldn’t parse the more complicated attachment names a while ago. IMO the only option for commercial software is the Chilkat plugin.

I have a home grown parser that catches most of the more complex stuff. I need to redo this with the Chilkat plugin in the next months. Wanted to make this open-source. But I need to finish the 64bit version of my software first.

Beatrix, you said “…the only option for commercial software is the Chilkat plugin” right after you say “The Chilkat plugin…fails as soon as you get multipart emails.” Those two statements seem contradictory to me? Also, can you give an example of “complicated attachment names” that cause problems for MBS? I’m dealing primarily with multi-part emails (lots of attachments and embedded images and stuff, so it sounds like neither plugin will be smooth sailing :frowning:

Christian, thanks for the link–I had overlooked some of those functions and the sample Email Viewer, so I look forward to trying them out tomorrow!

There is a function in the Chilkat plugin for parsing messages. This got me about 90% of my test mails with simple structures. There are more functions to take the message apart and iterate through the parts. Which is quite a bit of work to get right.

I’m not at home so I don’t have the code in front of me. You can have attachment names in multiple rows like:

continuation character + attachment end

Combine this with encoding in the form of ?utf8? and you can get pretty complex stuff. As far as I remember the CURL stuff didn’t support this at all.

Christian, I was finally able to test out the Email Viewer sample project that’s included with the MBS plugins and based on my preliminary testing, it looks like it works fine for parsing out MIME messages for display and downloading of attachments. I still haven’t (yet) done hard-core testing of complex attachment names that Beatrix mentioned, but so far so good!

Basically, what I’m doing at the moment is downloading email from Office365 via IMAP using the MBS CURLS plugin, save it in an SQL database to keep it local so that each message never needs to be pulled more than once. The list of messages is presented to the user and when they select one, it is displayed in an HTMLViewer after being parsed using MimeEmailMBS.

So far, so good! Thanks all!

I wanted to give you the example for the attachment name:

Content-Transfer-Encoding: base64
Content-Type: application/octet-stream;
Content-Disposition: attachment;

That is german. I really would be interested if CURL can parse this.

What program gives that output?

This is raw data from an example mail with the most complicated encoding I know about. Funnily it was a mail to me. It’s base64 encoded UTF8 data concatenated together.

I’ve never seen concatenated headers like that, kinda neat, kinda scary :wink: