Author |
|
Michael Müller Newbie
Joined: 09 February 2009 Location: Germany
Online Status: Offline Posts: 1
|
Posted: 09 February 2009 at 8:32am | IP Logged
|
|
|
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!
Michael
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 09 February 2009 at 9:04am | IP Logged
|
|
|
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.
Regards,
Alex
|
Back to Top |
|
|