Hi,
i have some problems in processing attachments. I want to distinguish between embedded attachments (like graphics etc.) and file attachments.
Is use the attachment properties PR_ATTACH_CONTENT_ID_A and PR_ATTACH_CONTENT_ID_W to detect embedded attachments.
The code looks like this
public static void AttachmentTest()
{
string strFileName = “c:\temp\HtmlMail2.msg”;
Console.WriteLine(string.Format(“Processing mail {0} …”, strFileName));
MapiMessage msg = MapiMessage.FromFile(strFileName);
foreach (MapiAttachment attach in msg.Attachments)
{
if (attach.Properties.Contains(MapiPropertyTag.PR_ATTACH_CONTENT_ID_A) || attach.Properties.Contains(MapiPropertyTag.PR_ATTACH_CONTENT_ID_W))
{
Console.WriteLine(string.Format(“Embedded Attachment {0}”, attach.DisplayName));
}
else
{
Console.WriteLine(string.Format(“Attached File {0}”, attach.DisplayName));
}
}
msg = null;
}
If i run the code with the attached Html-Mail then all attachment are identified as embedded. The displayname of the attached file is empty. If i open the mail with MS Outlook 2010 then outlook shows the attched file SKMBT_C45111072510081.pdf.
.net runtime 2.0
Aspose.Email 1.1.0.0
Best regards, Martin
internal bugid#4337
Hi,
Hi,
var mapi = MapiMessage.FromFile(“HTMLMail2.msg”);
foreach (var att in mapi.Attachments)
{
if (att.Properties.Contains(0x7FFD0003) && att.Properties[0x7FFD0003].GetInt32() == 8)
{
Console.WriteLine("Embedded, inline or linked Attachment File Name: " + att.LongFileName);
}
else
{
Console.WriteLine("Regular Attachment File Name: " + att.LongFileName);
}
}
somehow thats not working for me to distinguish those attachments.
however this works for me:
C#
Console.WriteLine("Regular Attachment File Name: " + att.LongFileName); } }
with regards,
Jitte Dooper
Hi Jitte,