What I noticed is that if the message is only an attachment to property "Attachments.Count" is zero if the message has two attachments to property
"Attachments.Count" is equal to "1", if the message has attachments 3 "Attachments.Count" is equal to "2" and so on.
Or is this always losing the first attachment
foreach (ImapX.Message msg in Messages)
{
msg.Process ();
rowMSG ["Attachments"] = msg.Attachments.Count> 0? true: false;
}
Comments: ** Comment from web user: dinhoguitars **
Hey Pavel, I think I detected the problem .. When the attachment is a text file, it comes as "text / plain", as that he is falling in the first "if"
if (current.ContentType! = null && current.ContentType.ToLower (). Contains ("text / plain"))
when the attachment is of type doc for example it comes as "application / msword" so he falls into the "if" attached.
When you have attached the first part of the ContentType comes to "multipart / alternative"
I think if you change the condition preira
if (current.ContentType! = null && current.ContentType.ToLower (). Contains ("text / plain"))
to
if (current.ContentType! = null && (current.ContentType.ToLower (). Contains ("text / plain")) | | current.ContentType.ToLower (). Contains ("multipart / alternative")))
the problem will be solved. what do you think?
Ex
1º attachment: text/plain; name="venda.txt"
if (current.ContentType != null && current.ContentType.ToLower().Contains("text/plain"))
{
TextBody = current;
TextBody.TextData = TextBody.ContentStream;
}
2º attachment: application/msword; name="Doc1.doc"