Skip to content

Instantly share code, notes, and snippets.

@cyyself
Created January 30, 2024 09:34
Show Gist options
  • Save cyyself/678348cbeca098c4d9557e876a7b1be7 to your computer and use it in GitHub Desktop.
Save cyyself/678348cbeca098c4d9557e876a7b1be7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import mailbox
import sys
mbox = mailbox.mbox(sys.argv[1])
mbox.update(enumerate(sorted(mbox, key=lambda x: x.get("Subject"))))
mbox.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment