Closed MrYossu closed 4 years ago
See the answer in your issue that you opened on MSGReader
I asked the question here because I couldn't see how to do it from that answer. You linked to a changeset, but how does that help me read an .msg file and save it as .eml?
Sorry if I missed something, but I couldn't see how to do this from your link.
@Sicos1977 OK, I downloaded the source and had a look at the sample project. I see there is a Converter.ConvertMsgToEml
method, which looks exactly like what I want, but it just throws a NotImplementedException
So how do I do the conversion?
You need to download the fork from the other person and compile that one. At the moment I'm not behind my laptop anymore. I can help you but that will be tomorrow.
@Sicos1977 I did download his fork, and that's the one that threw the exception. Please see this line of code.
If you get chance to help tomorrow I'd really appreciate it.
Thanks
I'll look into it tomorrow. I think his code is complete so don't know why you get that exception because that is something that is coming from my repro
@Sicos1977 Thanks
You can get the correct version (with the conversion code) from this link, it seems that he has made a branche that he modified.
https://github.com/BerendHabekotte/MsgKit/tree/US3172_ConvertMsgToEml
Download it as a ZIP, that is what I did and it gave me the code with the MSG to EML conversion
https://github.com/BerendHabekotte/MsgKit/archive/US3172_ConvertMsgToEml.zip
I'll will see if it is something that I can add the the msgreader. I don't want to mix MsgKit and MsgReader like what he did.
@Sicos1977 Thanks for that, but the code doesn't work properly. As an experiment, I added the following line into the sample project in one of the button handlers...
Converter.ConvertMsgToEml(@"D:\msgs\355649890.msg", @"D:\msgs\355649890.eml");
This converted the email itself, but all attachments were empty.
I tried this with a few .msg files, and had the same problem with all of them.
Any ideas? Thanks again.
@Sicos1977 Not trying to be rude, but did you get chance to look? As I said, the conversion mostly worked, but all the attachments were blank.
Thanks again for your help
You mean you did not have any attachments or when you tried to open them there was nothing in it?
@Sicos1977 I can't send any example files as they contain confidential information. However, some screenshots might clarify.
If I open one of these converted files (now saved as .eml), I can see that the attachment is recognised (this is in Thunderbird)...
If I open this, it is blank (this is in the Chromium-based Edge, which is my default PDF viewer)...
If I open a .jpg attachment, I get this...
If I try to view an attached text file, I can open it, but it is just blank lines.
If I save these attachments to disk, they look around the right size, but I guess something has gone wrong with the conversion, and the data has been lost.
Any ideas? Thanks again.
Sorry, thought I'd replied to this. I wondered why you hadn't answered!
The message had attachments, and these were of the correct size. A text attachment came out as a blank document, an image was unopenable and a pdf file opened, but was just a blank page.
Does that help? Thanks again
Oops, seems I did reply! I wonder why my browser didn't show it until just now. Ho hum.
@Sicos1977 Any chance you'd be able to look at this? I really need to get these files converted.
Thanks
I have a pile of .msg files, and want to be able to open them on a machine that doesn't have Outlook installed. I'd like to convert them to .eml files. Can your package do that?
Thanks