Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET IMAP

 AfterLogic Forum : MailBee.NET IMAP
Subject Topic: Download email by parts Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
sbrady
Newbie
Newbie


Joined: 02 March 2009
Online Status: Offline
Posts: 12
Posted: 06 July 2009 at 7:06am | IP Logged Quote sbrady

We are trying to follow an example posted on this site regarding downloading emails by parts, seen here http://www.afterlogic.com/mailbee-net/docs/MailBee.ImapMail. Envelope.GetEnvelopeItem.html


However, wehenever we try to download the header as the example indicates, we get a null value returned. Any reason for this (see code below). Also, the reason we are doing this is because we don't want to download attachments everytime we open a message (it takes too long). If there is a better way to deal with attachments than this I'd love to hear it. Thanks

imap.DownloadEnvelopes(uid.ToString(), true, EnvelopeParts.Uid, 0, null, new string[]{"BODY.PEEK[2.HEADER]","BODY.PEEK[2]"})[0].GetEnvelopeItem("BODY[2.HEADER]", true)
returns null


imap.DownloadEnvelopes(uid.ToString(), true, EnvelopeParts.Uid, 0, null, new string[]{"BODY.PEEK[2.HEADER]","BODY.PEEK[2]"})[0].GetEnvelopeItem("BODY[2]", true)

returns array

Back to Top View sbrady's Profile Search for other posts by sbrady
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 07 July 2009 at 6:35am | IP Logged Quote Alex

Could you show the part of log which shows getting body structure and then DownloadEnvelopes for that particular attachment?

I just checked the code you used and it works just fine. Probably, your mail server supports only particular syntax (like BODY.PEEK[2]). This is because getting custom parts in FETCH responses is rarely used by mail clients and mail server vendors sometimes pay very little attention to implementing this kind of functionality.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 07 July 2009 at 6:39am | IP Logged Quote Alex

One more question, though. Why do you need to get headers separately (provided that you anyway then download the entire attachment with the headers)?

Since getting BODY.PEEK[2] works fine for you, you can use:
Code:

MimePart part = MimePart.Parse(mimePartData);
Attachment picture = new Attachment(part);


to get Attachment object with all the headers.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 20 August 2009 at 6:19am | IP Logged Quote Alex

Update. For Gmail, it's required to use BODY.PEEK[2.MIME] instead of BODY.PEEK[2.HEADER]

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
rekk1986
Newbie
Newbie


Joined: 30 December 2009
Location: United States
Online Status: Offline
Posts: 4
Posted: 12 January 2010 at 1:00am | IP Logged Quote rekk1986

the code that Alex give doesn't work, please give me another code please, Thanks
Back to Top View rekk1986's Profile Search for other posts by rekk1986
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 12 January 2010 at 1:29am | IP Logged Quote Igor

What exactly doesn't work? Do you get any errors?

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 

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