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

Extract nested attachments (msg in msg) #7

Closed
wants to merge 1 commit into from

Conversation

jbfuzier
Copy link

A quick addition to extract attachments from nested msg (an msg attached in a msg is not handled as a standard attachement)

My use case is to extract all the attachment I can to do some analysis on extracted file.

I have not thought on how to handle nested message body, cc, to..

How to handle nested message body, cc, to... ?
@moshekaplan
Copy link

I had the same issue that I was unable to retrieve data for attached MSG files.

Does this chance break any existing functionality?

@mattgwwalker
Copy link
Collaborator

Please give it a try. I'd love to have feedback. It would greatly help me if you could also include some test msg files that contained msg files as attachments. This would allow us to implement some automated testing for example.

@moshekaplan
Copy link

Here is a sample file you can use to replicate the issue:
msg_inside_of_msg.zip

Here is my sample code:

    fname = sys.argv[1]
    msg = Message(fname)
    for attachment in msg.attachments:
        filename = attachment.longFilename
        # Otherwise use the short filename
        if filename is None:
            filename = attachment.shortFilename
        # Otherwise just make something up!
        if filename is None:
            print "Filename missing"
        print "Size:", len(attachment.data)

Output:

Filename missing
Size:
Traceback (most recent call last):
File "msg.py", line 536, in
print "Size:", len(attachment.data)
TypeError: object of type 'NoneType' has no len()

@TheElementalOfDestruction
Copy link
Collaborator

Fixed in most recent update. If you believe the issue still exists, please open a new issue thread.

TheElementalOfDestruction pushed a commit that referenced this pull request Dec 28, 2018
TheElementalOfDestruction pushed a commit that referenced this pull request Dec 28, 2018
…-into-doing-it-his-way-debug-logger

Fixes: #7 Logging refactor by example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants