Search The ForumSearch   RegisterRegister  LoginLogin


 AfterLogic Forum : MailBee.NET IMAP
Subject Topic: Download Message without Atachements Post ReplyPost New Topic
Message << Prev Topic | Next Topic >>
Michael Müller

Joined: 09 February 2009
Location: Germany
Online Status: Offline
Posts: 1
Posted: 09 February 2009 at 8:32am | IP Logged Quote Michael Müller

Hi Community,

I'm using MailBee.NET IMAP as a part of the objects suite.

Is there a way to download a message without the attachements?

Thank you!
Back to Top View Michael Müller's Profile Search for other posts by Michael Müller
AfterLogic Support
AfterLogic Support

Joined: 19 November 2003
Online Status: Offline
Posts: 2200
Posted: 09 February 2009 at 9:04am | IP Logged Quote Alex

It's possible in theory but not straightforward. The IMAP protocol is very flexible but the problem really originates from the fact that e-mail standards (RFC822, MIME) do not define any section in an e-mail message for attachments.

Unlike header/body, attachments are the part of the body. I.e. the message structure is "the header + the body", not "the header + the body + the attachments". Thus, you can get the header only or the header with the body which includes attachments and what is usually referred as a body from the end user's point of view.

The body consists of a number of MIME parts which can be nested. An attachment is just a particular case of a MIME part. Others are HTML or plain-text bodies, embedded images, etc.

The IMAP protocol is flexible enough to allow you to request downloading particular MIME parts of the message. However, you need to know which parts to download because there is no common place for them. With IMAP, you can request downloading a body structure of the message. Uou can then iterate through this body structure to determine which MIME parts meet your demands (in your case, it's a plain-text or HMTL body). Then, you can request downloading this MIME part.

The drawbacks:
- you issue two commands to the server (2 round-trips instead of 1 when downloading entire message). Thus, you can get slower performance with body structures
- many mail servers work bad with body structures because popular mail clients like Outlook do not need this functionality in order to work and thus the mail server manufacturers pay little attention to proper implementing of body structures

Useful example to start with is located in Envelope.GetEnvelopeItem topic. It does an opposite thing: downloads attachments but not the text part.

Back to Top View Alex's Profile Search for other posts by Alex

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide