Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotImplementedError: Current version of extract_msg does not support extraction of containers that are not embedded msg files. #40

Open
SuvroBaner opened this issue Oct 31, 2018 · 14 comments
Assignees
Labels
Accepted This feature request has been accepted and will be developed enhancement In Progress This issue or feature request has been confirmed or approved, respectively, and is being worked on.

Comments

@SuvroBaner
Copy link

Hi,

When I pip install it I get 0.11 distribution which is giving the following error -

"NotImplementedError: Current version of ExtractMsg.py does not support extraction of containers that are not embeded msg files."

A few days back I wasn't getting an error and I realize that I was using a different distribution 0.3.

Could you please look at it ? May be something has broken with the latest changes.

Thanks
Suvro

@TheElementalOfDestruction
Copy link
Collaborator

Greetings.

This error should be caused by a pretty rare case in msg files that I am still trying to understand. I'm currently looking for more examples of it so I can determine how to process it.

However, from what you say, it seems as if the error is being thrown during the pip instillation itself rather than the running of the module. Is this the case?

@SuvroBaner
Copy link
Author

No sorry, it came while I was running the module. Now the thing is I wasn't getting the error with the version 0.3 but started getting the error with the version 0.11 (which I got from the latest pip install).

The error was not coming couple of days ago.

@TheElementalOfDestruction
Copy link
Collaborator

Ah, that makes more sense.

Version 0.3 was not properly equipped to handle storage streams in attachments, and version 0.11 can partially handle them.

To help with debugging, it would be much appreciated if you could place the msg file that is creating the error (or at least one of them) into an archive file (I.e. zip, rar, 7z) and send it to [email protected]. From there I can verify whether it is a problem in the program or the email.

@SuvroBaner
Copy link
Author

I would love to do that. I have been getting this error in few scenarios. As they are client sensitive emails, let me see what all contents I can remove and send that across. If you could give me sometime that would be great. Thanks.

@TheElementalOfDestruction
Copy link
Collaborator

No problem at all. Take as much time as you need.

I personally find that this can happen when a signature that contains and image is applied to an email. For whatever reason, it stores it in a very strange way.

@TheElementalOfDestruction
Copy link
Collaborator

Hi. I'm aware that I said to take as much time as you need, but it has been 21 days and I have yet to receive the data. Perhaps you did send it and it went, unnoticed, into my spam folder. This is just a check to make sure you haven't forgotten.

This is also a notice that in the next major version (0.20) I will be adding some debug code that should allow me to work on fixing the problem without revealing any sensitive data from the message files. Simply set ExtractMsg.debug = True before creating an ExtractMsg.Message instance if you are importing the module, or use the new --debug flag if you are using it through the command line.

TheElementalOfDestruction pushed a commit that referenced this issue Apr 18, 2019
@byc-art
Copy link

byc-art commented May 31, 2020

Hello,

I stumbled across this post when I looked up the error messages in version 0.23.3. Similar to @SuvroBaner I've got an error saying the current version doesn't support extraction of containers that are not embedded msg files and together with a few other attachments errors. I'm able to extract attachments (docx, xls, pdf, png, gif, zip) until I got the errors.

I notice this message exists in previous versions, not sure if this has been resolved? Could you please take a look?

Thanks,
Cyb

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/extract_msg/message.py", line 490, in attachments
    return self._attachments
AttributeError: 'Message' object has no attribute '_attachments'
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/cybele.wong/Library/Python/3.7/lib/python/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-21-f19448c5758d>", line 2, in <module>
    msg = extract_msg.Message(filepath) 
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/extract_msg/message.py", line 89, in __init__
    self.attachments
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/extract_msg/message.py", line 503, in attachments
    self._attachments.append(self.__attachmentClass(self, attachmentDir))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/extract_msg/attachment.py", line 47, in __init__
    'Current version of extract_msg does not support extraction of containers that are not embedded msg files.')
NotImplementedError: Current version of extract_msg does not support extraction of containers that are not embedded msg files.

@TheElementalOfDestruction
Copy link
Collaborator

@byc-art so the reason this happens is because there are some attachments that form in a way that literally has no defined standard in the msg protocol. The only thing we can do is try to write code that can detect this and from there try to detect how the data is being stored, unfortunately, we dont have nearly enough examples to even begin to do this so until then there is nothing we can do.

You can help by sending any messages that cause this error to [email protected] (my email). These messages must be contained in a zip file or the email providers will mess up the file type. Any messages sent will not be exposed to the public in any way without your permission and will only be used to research a way to hopefully get rid of this error message.

Thank you for your time.

@byc-art
Copy link

byc-art commented Jun 1, 2020

Thanks @TheElementalOfCreation for explaining this. Could you share the list of attachment formats that is defined in the msg protocol? I know i have a thousands of file formats in my messages, is there a way to bypass the errors and skip the problematic attachment/ emails? I can try to identify characteristics in messages that cause the issues and let you know.

@TheElementalOfDestruction
Copy link
Collaborator

@byc-art from what we can tell it doesn't actually have to do with file format. We aren't actually sure what causes it which is another reason why we so desperately need examples of emails that throw the error.

@BenoitTS
Copy link

I faced the same problem (version 0.23.1) and just sent you an email with the .msg file raising the error. I managed to simplify the content of the email to a single image that was in the signature of the sender.
I'm writing it here in case it goes into your spam.

@TheElementalOfDestruction
Copy link
Collaborator

@BenoitTS I believe that your specific example (Like some of the ones I already have) was generated by outlook creating its own application specific attachment type. As such, the documentation for this is not with the documentation for the msg file format. Unfortunately, I have yet to be able to track down ANY documentation about Outlook's custom attachment type(s). Until such a time, I'm afraid it is likely this feature will not even be partially implemented.

@TheElementalOfDestruction TheElementalOfDestruction changed the title Current Version throwing an exception NotImplementedError: Current version of extract_msg does not support extraction of containers that are not embedded msg files. Jan 5, 2021
@TheElementalOfDestruction TheElementalOfDestruction added enhancement In Progress This issue or feature request has been confirmed or approved, respectively, and is being worked on. Accepted This feature request has been accepted and will be developed labels Jul 4, 2023
@TheElementalOfDestruction
Copy link
Collaborator

I managed to get enough examples and some rather obscure comments and references and pieced together basic support for images that outlook sometimes attaches in that strange format. It won't yet save inside of the body, as that requires a lot more infrastructure that can understand the RTF and some other things, but it can save them as attachments. This is currently only available on next-release, but it is being bundled into the 0.42.0 release that is coming sometime soon.

@TheElementalOfDestruction
Copy link
Collaborator

Partial support for the most common custom attachment has been added, including the ability to save it, however these attachments are usually meant to be inserted into the body. As that requires manipulating the RTF, that is not yet currently possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted This feature request has been accepted and will be developed enhancement In Progress This issue or feature request has been confirmed or approved, respectively, and is being worked on.
Projects
None yet
Development

No branches or pull requests

4 participants