0 votes
by (330 points)
edited

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

Applies to: Rebex Secure Mail

1 Answer

+1 vote
by (147k points)
edited

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.

by (147k points)
Pleae let us know if this doesn't solve the problem.
by (330 points)
Hi Lukas, That does the trick, thank you so much!
...