Author |
|
sbrady Newbie
Joined: 02 March 2009
Online Status: Offline Posts: 12
|
Posted: 06 July 2009 at 7:06am | IP Logged
|
|
|
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 |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 07 July 2009 at 6:35am | IP Logged
|
|
|
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 |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 07 July 2009 at 6:39am | IP Logged
|
|
|
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 |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 20 August 2009 at 6:19am | IP Logged
|
|
|
Update. For Gmail, it's required to use BODY.PEEK[2.MIME] instead of BODY.PEEK[2.HEADER]
Regards,
Alex
|
Back to Top |
|
|
rekk1986 Newbie
Joined: 30 December 2009 Location: United States
Online Status: Offline Posts: 4
|
Posted: 12 January 2010 at 1:00am | IP Logged
|
|
|
the code that Alex give doesn't work, please give me another code please, Thanks
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 12 January 2010 at 1:29am | IP Logged
|
|
|
What exactly doesn't work? Do you get any errors?
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|