Git Product home page Git Product logo

cleanup-maildir's Introduction

The cleanup-maildir py script floating around on the net did not work
with a host I read mail on that runs python 2.5.2. I patched it, then
a week later realized that , then realized I also read mail on a box
that only has python 2.4. So this now works with both.

Note that using 'INBOX' refers to your root maildir (~/Maildir)

Example usage:

cleanup-maildir -d 1 --age=120 --archive-folder=Archive archive INBOX
cleanup-maildir -d 1 --age=90 --archive-folder=Archive.src archive src

cleanup-maildir's People

Contributors

jvc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cleanup-maildir's Issues

HeaderParseError

Hi,

I'm having this problem with cleanup-maildir when i run it on a large folder of mail, i get this error:

Traceback (most recent call last):
File "./cleanup-maildir", line 504, in
cleaner.clean(mode, dir, minAge)
File "./cleanup-maildir", line 405, in clean
self.log(logging.DEBUG, "Keeping #%d (fresh)" % i, msg)
File "./cleanup-maildir", line 410, in log
subj = msgObj.getSubject()
File "./cleanup-maildir", line 209, in getSubject
email.Header.decode_header(s)))
File "/usr/lib/python2.6/email/header.py", line 101, in decode_header
raise HeaderParseError
email.errors.HeaderParseError

i added some debug code, to try and get more info, but I'm no expert in python so i'm a bit lost as to how i might get more info.

i changed the code to read:
def getSubject(self):
"""get the message's subject as a unicode string"""

    import email.Header
    s = self.getheader("Subject")
    try:
        print "DEBUG: subject=", s
        return u"".join(map(lambda x: x[0].decode(x[1] or 'ASCII', 'replace'),
                            email.Header.decode_header(s)))
    except(LookupError):
        return s
    except:
        print "Unexpected error:", sys.exc_info()[0]
        print "email.Header.decode_header(s) s =", s
        raise

also note -
here is my debug output
INFO:MaildirCleaner:(Not really) Archiving #18127 to a Reference.2007: TCF: UNS: Segfault in Samba
DEBUG: subject= eBay Favourite Search: m-audio
INFO:MaildirCleaner:(Not really) Archiving #18128 to a Reference.2007: eBay Favourite Search: m-audio
DEBUG: subject= Updated barcodes showing essdale park counter stand with barcode
DEBUG: subject= =?UTF-8?B?VGhhbmsgeW91IGZvciB5b3VyIGZlZWRi?==?UTF-8?B?YWNr?=
Unexpected error: <class 'email.errors.HeaderParseError'>
email.Header.decode_header(s) s = =?UTF-8?B?VGhhbmsgeW91IGZvciB5b3VyIGZlZWRi?==?UTF-8?B?YWNr?=

see how the header is funny for the last one that seems to cause the error?

any suggestions?

Jason

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.