Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET IMAP

 AfterLogic Forum : MailBee.NET IMAP
Subject Topic: Why is HasAttachment false? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
mnoreen
Newbie
Newbie


Joined: 17 July 2012
Location: United States
Online Status: Offline
Posts: 19
Posted: 18 July 2012 at 10:26am | IP Logged Quote mnoreen

I'm using MailBee.NET Objects and, in particular, Imap, to loop through messages in a custom mailbox. When I look at these messages in my Outlook (2010) client, or through webmail (again, on Exchange 2010), these messages show up with a text file attachment. But when I loop through msg collection using the Imap object, the HasAttachments property is always false.

I'm using C#/4.0/VS2010. I've set a breakpoint in my code so I can inspect the MailMessage object as I'm looping through them. The individual msg has a content type of "multipart/report", but I don't seem to see how to get the text from any of the "parts"...?

Basically, I need to get to the text in that attachment, so any advise would be greatly appreciated.
Back to Top View mnoreen's Profile Search for other posts by mnoreen
 
mnoreen
Newbie
Newbie


Joined: 17 July 2012
Location: United States
Online Status: Offline
Posts: 19
Posted: 18 July 2012 at 12:01pm | IP Logged Quote mnoreen

Here's some more specifics:

Assembly version: 7.2.4.366.

For testing purposes, I call DownloadEntireMessage method to download the first message in the mailbox. Let's say that's saved to a MailMessage variable called "msg".


1) msg.MimePartTree.GetAllParts().Count --> returns 3

2) msg.MimePartTree.GetAllParts()[0] matches msg.RawHeader

3) msg.MimePartTree.GetAllParts()[1] matches msg.BodyPlainText

4) When I dump out msg.MimePartTree.GetAllParts()[2], I really don't get anything of use at all. The only properties with any values of interest are:

ContentType: "text/plain"
RawHeader: "Content-Type: text/plain\r\n\r\n"

5) I can call the msg.SaveMessage method and save the message to a .eml file. When I open that .eml file in Notepad, I can confirm the 3 "parts" where the first is the message headers, the second is the body, and the 3rd is the text that I see as an "attachment" in Outlook, but don't seem to be able to get at using code...



Back to Top View mnoreen's Profile Search for other posts by mnoreen
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 19 July 2012 at 5:07am | IP Logged Quote Igor

If you iterate through MimePartTree and Attachments collections, are you getting non-zero number of elements in either of those two?

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


Joined: 17 July 2012
Location: United States
Online Status: Offline
Posts: 19
Posted: 19 July 2012 at 6:15am | IP Logged Quote mnoreen

I'm not entirely sure if this is what you mean, but..

1) msg.Attachments.Count returns 0 (zero).

When I loop through the MimePartTree array, I don't see any Attachment property whatsoever... here's what is returned from the last element in that array (which, as far as I can discern, is what I'm after):

msg.MimePartTree.GetAllParts()[2]
{MailBee.Mime.MimePart}
    Boundary: ""
    Charset: ""
    ContentID: ""
    ContentLocation: ""
    ContentType: "text/plain"
    Description: ""
    Disposition: ""
    Filename: ""
    Headers: {MailBee.Mime.HeaderCollection}
    IsComplete: true
    IsFile: false
    IsInline: true
    IsMessageInside: false
    IsRelated: false
    MailEncodingOriginal: ""
    Name: ""
    PartType: PlainText
    RawHeader: "Content-Type: text/plain\r\n\r\n"
    Size: 1277
    SubParts: null


Back to Top View mnoreen's Profile Search for other posts by mnoreen
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 19 July 2012 at 6:24am | IP Logged Quote Igor

My mistake, sorry. I meant BodyParts collection rather than MimePartTree. It can be iterated as shown here.

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


Joined: 17 July 2012
Location: United States
Online Status: Offline
Posts: 19
Posted: 19 July 2012 at 9:54am | IP Logged Quote mnoreen

Yes! The test message I've been using has 2 elements in the BodyParts collection. The last one appears to contain the text that otherwise shows up as an attachment in Outlook.

Thank you!! A bit confusing though...
Back to Top View mnoreen's Profile Search for other posts by mnoreen
 

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