Git Product home page Git Product logo

maildir2mbox's People

Contributors

bluebird75 avatar nyov avatar phikal avatar thijstriemstra avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

maildir2mbox's Issues

Long road to make it true

Windows 7 x64, Python 3.8.1, script has been downloaded to C:\Python\Scripts, then

$ py maildir2mbox.py c:\MailOld\Trash c:\MailNew\Trash
2020-03-15 15:09:27 Russia TZ 2 Standard Time [INFO ] c:\MailOld\Trash -> c:\MailNew\Trash          
Traceback (most recent call last):                                                                  
  File "maildir2mbox.py", line 131, in <module>                                                     
    main(args.maildir_path, args.mbox_filename)                                                     
  File "maildir2mbox.py", line 86, in main                                                          
    maildir2mailbox(dirname, mboxname)                                                              
  File "maildir2mbox.py", line 42, in maildir2mailbox                                               
    mails = len(maildir)                                                                            
  File "C:\Python\lib\mailbox.py", line 412, in __len__                                             
    self._refresh()                                                                                 
  File "C:\Python\lib\mailbox.py", line 529, in _refresh                                            
    mtime = os.path.getmtime(self._paths[subdir])                                                   
  File "C:\Python\lib\genericpath.py", line 55, in getmtime                                         
    return os.stat(filename).st_mtime                                                               
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'c:\\MailOld\\Trash\\new'

Contents

MailOld
└── Trash   
    ├── cur
    │   └── zyedidia%2fmicro%2freleases%[email protected]
    └── tmp 

How do I proceed?

Error when running on Ubuntu 18.04

I get the following when running python maildir2mbox --help:

File "maildir2mbox.py", line 30
print(prefix, *args)
^
SyntaxError: invalid syntax

Exception while processing msg

Dear bluebird75,
The script is throwing an error.

23:50:28 Progress: msg 173400 of 225509
23:50:29 Progress: msg 173500 of 225509
ERROR 23:50:29 Exception while processing msg with key: 1642324253.M699656P643386.mail,S=3478,W=3548
Traceback (most recent call last):
  File "/Volumes/T7 Touch/MailArchive/maildir2mbox.py", line 205, in <module>
    convert(Path(args.maildir_path), Path(args.mbox_filename), bool(args.recurse))
  File "/Volumes/T7 Touch/MailArchive/maildir2mbox.py", line 105, in convert
    result = maildir2mailbox(maildir_path, mbox_path)
  File "/Volumes/T7 Touch/MailArchive/maildir2mbox.py", line 81, in maildir2mailbox
    mbox.add(msg)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/mailbox.py", line 606, in add
    self._toc[self._next_key] = self._append_message(message)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/mailbox.py", line 761, in _append_message
    offsets = self._install_message(message)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/mailbox.py", line 833, in _install_message
    self._dump_message(message, self._file, self._mangle_from_)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/mailbox.py", line 216, in _dump_message
    gen.flatten(message)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/email/generator.py", line 116, in flatten
    self._write(msg)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/email/generator.py", line 181, in _write
    self._dispatch(msg)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/email/generator.py", line 218, in _dispatch
    meth(msg)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/email/generator.py", line 268, in _handle_multipart
    self.write(subparts)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/email/generator.py", line 410, in write
    self._fp.write(s.encode('ascii', 'surrogateescape'))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 532-537: ordinal not in range(128)

Is there any way to fix it?

Stray *.sbd folders

Hi, I am using this very nice tool to convert a batch of old directories with mail in Maildir format to a mailbox format for archiving. However, I have noticed that each conversion leaves a *.sbd directory around. Is this intentional? The original tool by Frederic would remove the directory.

recursivity doesn't place subfolders inside parent folders when using "official" structure

Hello,

first thank you for this script! I had a much harder time than expected to import maildir into Thunderbird without a detour through an imap server, and this script is the one I found!

I use the latest version 1.0 from april 21st of 2020, and I have the "official" maildir format (screenshot)
Screenshot_20221222_152146
When using maildir2mbox.py -r Maildir_old/ mboxX (using 22.04 and python 3.10.6), I get

maildir2mbox_orig.py -r Maildir_old/ mboxX
ERROR 15:32:49 Missing `new` and/or `cur` subdirectories in path Maildir_old, aborting conversion
15:32:49 Maildir_old/.HO restructuring -> mboxX.sbd/HO restructuring
15:32:49 Processing 77 messages in Maildir_old/.HO restructuring
15:32:49 Maildir_old/.HO restructuring.AS -> mboxX.sbd/HO restructuring.AS #<-- the folder should be calld AS.sbd and be in HO restructuring
15:32:49 Processing 16 messages in Maildir_old/.HO restructuring.AS #<-- the emails should be moved inside HO restructuring/ in a file AS
15:32:49 Done with 1 errors. # can be ignored I think

I also tested it with the provided test_data and if I e.g. move the .coincoin folder to the same level as the .INBOX.toto folder (and rename it to .INBOX.toto.coucou) it also wrongly gets placed next to .INBOX.toto (and not inside .INBOX.toto).

I think the problem lies in maildir_sub_path (? or of course, I wrongly apply the script) and I tried to debug it in an online python debugger but had troubles getting the correct variable (path info) of maildir_path to be used. I'm happy to investigate further, e.g. if somebody tells me how I can use a variable depending on a local folder inside an online debugger.

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.