.msg created from .mht is giving error "Cannot read the item" when opening with Microsoft outlook


#1

I generated the .MHT file from .rtf file ( containing images and rich text) using aspose.words.Document:
Document doc = new Document(rtfPath);
doc.save(mhtPath, com.aspose.words.SaveOptions.createSaveOptions(SaveFormat.MHTML));

Now I created:
MapiMessage msg = MapiMessage.load(mhtPath, new MhtmlLoadOptions());
msg3.setSenderEmailAddress("testuser1@gmail.com");
msg3.setReplyTo("testuser2@gmail.com");
msg3.setSubject(“Test email .msg creation”);
msg3.save(msgfromrtfPath, SaveOptions.getDefaultMsg());

Though the .msg got created, I wasn’t able to open the generated .msg file from outlook.

Please let me know if there is anything wrong in this approach if not please let me know how I can create a .msg file from .rtf. Kindly note that .rtf file has some embedded image files in it.

Thanks,
Venkata


#2

@pvsnmurthy,

To ensure a timely and accurate response, please ZIP and attach the following resources here for testing.

  • Input .rtf document
  • Aspose.Words generated .mhtml file
  • Aspose.Email generated .msg file causing the error

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.


#3

Thank you for looking into this.
Please find the RTF2MSG.zip attached!
I first converted RichTextEmailWith1Attachment.rtf to RichTextEmailWith1AttachmentMod.mht
then from RichTextEmailWith1AttachmentMod.mht, I recreated RichTextEmailWith1AttachmentRecreated.msg.

But RichTextEmailWith1AttachmentRecreated.msg failing to open in outlook,
I am getting error “Cannot read the item”.RTF2MSG.zip (748.8 KB)


#4

@pvsnmurthy,

We were able to reproduce this issue at our end and have logged it as EMAILJAVA-34387 for further investigation. We’ll update you here once there is some feedback or a fix version available in this regard.


#5

Thank you Aspose team for creating a ticket for this.
Is there a timeline in which we can expect a solution for this issue?. I am asking this as it is important this be time bound for our usage of the library due to an upcoming release for us.
Greatly appreciate you resolving this issue as soon as possible.
Also, what user ID I need to use to track: EMAILJAVA-34387

Best Regards,
Venkata


#6

@pvsnmurthy,

The issue has been logged too recently and we are currently investigating it. We usually provide fixes in next month’s release in case complexity is not involved. Yes, you can refer to issue id: EMAILJAVA-34387 for status updates about this issue.


#7

Thank you Iqbal!
What credentials do I use for access EMAILJAVA-34387?
Can you please provide me access to this if required as I am unable to login using my aspose account credentials?

Thanks,
Venkata


#8

@pvsnmurthy,

The issue id is for your reference only that you can use to inquire the status of issue. Access to issue tracking system is internal and you won’t get access to it. You can also get idea about issue status at the lower right of this page against issue id.


#9

Ok, Thank you Iqbal, I will keep tracking for an update!


#10

Dear ASPOSE team: The issue seems to have been resolved, how do I get updates to the library that has the fix?


#11

@pvsnmurthy,

The fix version will be available after QA analysis at our end. We’ll notify you here once the fix version is available for download.


#12

Ok, Thank you!
Dear Aspose, please add the below notes to: EMAILJAVA-34387.

Notes to QA: Please do ensure that the embedded image in the RTF file is retained in the generated .msg file and that the embedded image can be viewed properly when the .msg file is opened by Outlook for viewing similar to how the RichTextEmailWith1Attachment.rtf looks like with the image in it.


#13

@pvsnmurthy,

Thank you details. We will attach these comments with issue ID EMAILJAVA-34387.


#14

Dear ASPOSE team,
Any update on the QA tests, is there a poosibility of getting an update for us to verify it from our side as soon as possible as we need this fix in order to prove this works for us, as our puchase approval authorities needs a proven solution.
So, I request you to provide us a timeline when we can expect a patch from you.

Thanks
Venkata


#15

The issues you have found earlier (filed as EMAILJAVA-34387) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by kashif.iqbal


#16

Thanks you Aspose for the update but I still have some unresolved issues with it which needs immediate attention.

Actually with the update you provided we are now able to view the saved .msg file, but for some reason some of the attributes are not getting set to the message, ie., I don’t see the To, ReplyTo and SenderEmailAddress not getting set when we are viewing the .msg in Outlook. I see the Subject field getting set properly but not others.
Can you please get this fixed as well ASAP and give us a new update when this is going to be fixed?

Missing these attributes, renders the .msg useless as the set information is lost.

What this means is that original code I gave had the below settings but they did NOT get saved to the .msg:
msg3.setSenderEmailAddress("testuser1@gmail.com");
msg3.setReplyTo("testuser2@gmail.com");
msg3.setSubject(“Test email .msg creation”);

though I am setting these, they are not getting saved to .msg when we do call msg3.save

Also, I happened to see that below message only when using the update you gave, I request you to check on these as well:
Jul 12, 2018 3:06:41 PM java.util.prefs.WindowsPreferences
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(…) returned error code 5.

Thanks,
Venkata


#17

@pvsnmurthy,

These properties are set to MapiMessage and you can view them using OutlookSpy or MFCMapi as well. Did you mean you want to set the From and To fields? If so, use the msg3.setSenderName and msg3.getRecipients().add method to set this information for display in output MSG file.


#18

Yes, I need to be able to set From, To, CC, BCC fields and I still see that these are not sticking and also when I use msg3.getRecipients().add to add a recipient, the generated .msg file is again not getting opened in Outlook, meaning the reported problem is back doing this.

Below is what I added as you recommended and it is not opening the .msg file, when opening with outlook it is giving the same reported error “Cannot read the item”:
msg2.getRecipients().add("testuser1@gmail.com", “test user”, 0);

If this is working fine at your end, can you please provide me a sample code that works for setting all the fields needed for sending email in MapiMessage object, From, To, CC, BCC fields and I will try the same here?
I request you to please try from your end with the code I sent you initially so everything is together.


#19

@pvsnmurthy,

We are looking into it and will soon share our findings with you here.


#20

@pvsnmurthy,

The file opens fine at our end even after adding recipients. However, information is not set as per the specified fields. We have logged the problem as EMAILJAVA-34396 for further investigation at our end and will update you here as some information is available in this regard.