.net – skip MIME-parsing to get an attachment

mimenetvb.netwindows-mobile

I am new here so first of all my greetings to you

I am writing an application to run on my Windows Mobile (Pocket PC). FYI, I am using VB.NET.

My idea is to use my e-mail account with my provider, who gives me a lot GB:s to use, as a virtual online storage disk. In a few words, more or less like the GMAIL-drive which you may have read about. I have already written code to connect, using a telnet-socket, to my provider's SMTP, POP3 and IMAP accounts. I can log in and thus so far so good.

In my specific case, I'm not interested in the e-mails themselfes but actually the attachments which will be my files on this virtual storgae-card. I have found a lot of free classes, mostly in C#, for downloading e-mails with attachments and most important, the MIME-parsing. Unfortunately all these classes, in one way or another, uses classes/namespaces of the Net Framework which are not included in the NET Compact Framework which is used by Windows Mobile. Writing a MIME-parser myself is far too complex for me and my knowledge.

Therefore, at least in regard to my code for receiving via POP3 or IMAP, I was thinking that once I have downloaded all bytes on my device, I would simply parse the full e-mail (verifying where the boundaries are) and get the part(s) which have been encoded in Base64 and then decode it and rename it using the name and the extension of the file which I wrote in the subject-field of the e-mail at the time of sending. In this way, I could perhaps avoid all stuff about MIME and all its meanings…

What regards, sending thru' SMTP, I still have to look into it. Any ideas would be appreciated.

Sorry for this romance – what do you think – can I skip getting MIME-parsers and just use ordinary string-parsing?

Kind regards,
Moster67

Best Answer

A MIME parser IS just a string parser. They're very easy to write, especially if you know you just want/need a subset of MIME types. Lookup the RFC and implement it yourself.