I am able to pop message from a smtp mail server. Then I extract the attachments from each messages and save them to a location. Sometime, the Mail.Attachments.Count return 0 even there are 2 to 3 attachment there. Below is my code:

            MailMessage message = client.GetMailMessage(i);

            MessageID = message.MessageId.ToString();
            Subject = message.Subject;
            EmailFrom = message.From.ToString();
            EmailTo = message.To.ToString();
            attachmentno = message.Attachments.Count;  

There may be also something strange in outlook, when I look at that email in Outlook 2007, normally, you can save the attachments by Office Bubble -> save attachements then a dialogue pop up, but with this email, it will not come up with the dialog box, but the outlook clear shows that there are 3 attachments and you can preview them.

AM I missing something?

Thanks, Eddie

asked 20 Jul '10, 05:46

Eddie's gravatar image

Eddie
324
accept rate: 0%

edited 10 Aug '10, 13:09

Rebex%20KB's gravatar image

Rebex KB ♦♦
258519


It's possible that the missing attachments are not in fact attachments, but rather embedded resources (a picture, for example). These are accessible through MailMessage.Resources' collection that is quite similar to theAttachments' collection. Check the value of message.Resources.Count in addition to message.Attachments.Count, it is quite possible the missing attachments will be there.

link

answered 20 Jul '10, 09:40

Lukas%20Pokorny's gravatar image

Lukas Pokorny ♦♦
2.4k28
accept rate: 31%

Pleae let us know if this doesn't solve the problem.

(20 Jul '10, 09:40) Lukas Pokorny ♦♦

Hi Lukas, That does the trick, thank you so much!

(17 Aug '10, 22:44) Eddie
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×36
×10
×1

Asked: 20 Jul '10, 05:46

Seen: 437 times

Last updated: 10 Aug '10, 13:09