Giter VIP home page Giter VIP logo

Comments (4)

Danamir avatar Danamir commented on June 19, 2024

get_payload() returns either a list or string, I thought that in this part of the code only str would be returnable, but it may depend on the mail server and/or the sender mail server.

I tested extensively with Gandi, Zimbra, and Gmail servers ; but I don't have access to other ones.

Without access to the mail or the server provoking the error I will have a hard time debugging.

Could you try to replace attachment_content = part.get_payload().encode("utf-8") line 488 by something like :

                    if isinstance(part.get_payload(), list):
                        attachment_content = part.get_payload(1).encode("utf-8")
                    else:
                        attachment_content = part.get_payload().encode("utf-8")  

But I'm not sure about using only the first part of the payload in this instance ; it could prevent the handling of multiple attachments.

from imap-attachment-extractor.

Danamir avatar Danamir commented on June 19, 2024

You can checkout the develop branch to try this solution.

from imap-attachment-extractor.

pengu-fr avatar pengu-fr commented on June 19, 2024

Thank you.
I've tried this :

                if part.is_multipart():
                    attachment_content = part.get_payload()
                else:
                    attachment_content = part.get_payload(True)

And it worked pretty well for about 14Gb (on a 20Gb Gmail account). But it fails again somewhere else, and I gave up (sorry).
But nice work here ! It would need a little more debugging, but it's already pretty usefull !

from imap-attachment-extractor.

Danamir avatar Danamir commented on June 19, 2024

No problem, thanks for testing anyway !

It's a pain to develop a tool for mail handling as the protocol is implemented differently by almost every servers. So I got it working for the few servers I use, but it may not be ok for others.

from imap-attachment-extractor.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.