Hi!
Another Problem is, that the attachements of an RTF Mail (embedded pictures) do not have a file-extension.
Hi Andi,
<span style=“font-size:9.0pt;font-family:“Courier New”;
mso-fareast-font-family:“Times New Roman”;color:navy”>public static void Email_705270()
{
MapiMessage mapi = MapiMessage.fromFile(<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:green”>"<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:green”>Test RTF Mail.msg");
<span style=“font-size:
9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:navy”>for(MapiAttachment att :
mapi.getAttachments())
{
System.<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:#660E7A”>out.println(<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:green”>"Long file name = " + att.getLongFileName());
System.<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:#660E7A”>out.println(<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:green”>"Display Name = " + att.getDisplayName());
System.<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:#660E7A”>out.println(<span style=“font-size:9.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:green”>"File Name = " +
att.getFileName());
}
}
Attachements work fine, inline images do not have a filename. I give it a try with the newest version as soon as I’m back to work.
Why are the inlined images extracted and not left base64 encoded in the message?
Best regards,
Andi
Hi Andi,
Inline images are treated as regular attachments with keeping the contents as other attachments. However, in message body, the contents are actually linked from the attachment. The structure of MapiMessage govern these guidelines and, hence, the implementation. Please feel free to write to us once you try the newest version. We’ll assist you further accordingly.
Hi!
Hi Andi,
This is not an issue with Aspose.Email API. I repeated the steps as you have mentioned and tried the following sample code. There is no PR_ATTACH_LONG_FILENAME property associated with the attachment that can be used to read the attachment filename. Also, MFCMapi also doesn’t show presence of any such information in the MSG file which further validates that Aspose.Email API is correctly behaving in this case.
Sample Code:
foreach (MapiAttachment att in msg.Attachments)
{
if (att.Properties[MapiPropertyTag.PR_ATTACH_LONG_FILENAME] != null)
{
Console.WriteLine(att.Properties[MapiPropertyTag.PR_ATTACH_FILENAME].ToString());
}
if (att.Properties[MapiPropertyTag.PR_ATTACH_LONG_FILENAME_A] != null)
{
Console.WriteLine(att.Properties[MapiPropertyTag.PR_ATTACH_FILENAME].ToString());
}
if (att.Properties[MapiPropertyTag.PR_ATTACH_LONG_FILENAME_W] != null)
{
Console.WriteLine(att.Properties[MapiPropertyTag.PR_ATTACH_FILENAME].ToString());
}
}
Hi,
Hi Andi,
Thank you for sharing your feedback. Please feel free to write to us if you have any further query related to the API.
Is there a possibility to save the embedded ole-objects as a user-friendly file? I can save the file without an extension - but how can I make for example an image out of it?
Hi Andi,
Determining the type of embedded ole-object is the actual limitation in this case. For an embedded image, you may note that the inline attachment is represented as a device independent bitmap and it can be saved to image using the following sample code. However, for other type of embedded objects, this may not help. Could you please share a sample MSG file with us for our further investigation into this issue?
Sample Code:
MapiMessage mapi = MapiMessage.fromFile(“RTF message with inline image.msg”);
ByteArrayOutputStream byteArrayOutputStream= new ByteArrayOutputStream();
mapi.getAttachments().get_Item(0).save(byteArrayOutputStream);
OutputStream outputStream = new FileOutputStream (“1.bmp”);
byteArrayOutputStream.writeTo(outputStream);
Thanks for your reply, I tried it and it works. I will test some other mails and I get further problems, I will post here again.
Hi Andi,
Thank you for sharing your feedback. Please feel free to create a new thread and share any new problem/inquiry with us if you face further. We’ll be glad to assist you further.