MapiAttachment.getLongFileName() = null when RTF Mail is sent

Hi!


I’m uploading a msg-File from Outlook to my webserver an parse it there. Works perfectly, but I have one strange issue:

If I send a RTF Mail with an image in it and take the message out of the sent-folger of outlook (the msg file), the filename of the image-attachement is null.
If I take the mail sent to myself from the inbox, it works nice.

Whats the problem here? I’m using Version 6.1.0.0 of aspose-email in java.

Best regards,

Andi

Another Problem is, that the attachements of an RTF Mail (embedded pictures) do not have a file-extension.

Any ideas?

Hi Andi,


Thank you for writing to Aspose support team.

I have used following simple code using latest library Aspose.Email for Java 6.3.0 and observed that Long file name is properly displayed for regular image attachment in the RTF mail on receiving end. You may please give a try using latest library and share the feedback.

I have also checked the properties of this RTF message using third party tool MFCMapi and observed that no extension is available for the inline image. You may please share your sample message with us to analyze it provide further assistance.

<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!


I just testet with the new version - still the same problem.

What I do exactly:
- send a RTF Mail with an embedded image with outlook
- drag the mail from the sent-folder on the desktop (sent-folder is important! the same mail in the inbox works without any problems!)
- open the mail with MapiMessage.fromStream()
- iterate over attachments
- try to get filename via attachement.getLongFileName()
- this fileName is NULL in my case.

Best regards,

Andi

Edit: I just tried to read the filename with mfcmapi - there is also no filename :(.

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,


I also found out, that it is not an issue with Aspose.Email API. So I have to find a solution to embed OLE-images in the mail, because our users cannot handle OLE objects.

Best regards and thanks for your help

Andi

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?


Or is there a possiblity to get the uncompressed rtf including images?

Thanks!

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.



Thanks for your great support!

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.