imap2maildir icon indicating copy to clipboard operation
imap2maildir copied to clipboard

Trouble pulling down all mail from Outlook.com IMAP?

Open victorhooi opened this issue 8 years ago • 1 comments

It seems that by default, we assume the IMAP account is Gmail:

Opening sqlite3 database '/Users/victorhooi/Documents/melmail/.imap2maildir.sqlite'
Exception!  Clearing locks and safing database.
Traceback (most recent call last):
  File "./imap2maildir", line 577, in main
    seencache=seencache)
  File "./imap2maildir", line 464, in copy_messages_by_folder
    outdict['total'] = len(folder)
  File "/Users/victorhooi/code/imap2maildir/simpleimap.py", line 390, in __len__
    raise Exception('folder %s: %s' % (self.__folder, data[0]))
Exception: folder [Gmail]/All Mail: [TRYCREATE] Specified mailbox does not exist.
Traceback (most recent call last):
  File "./imap2maildir", line 596, in <module>
    main()
  File "./imap2maildir", line 577, in main
    seencache=seencache)
  File "./imap2maildir", line 464, in copy_messages_by_folder
    outdict['total'] = len(folder)
  File "/Users/victorhooi/code/imap2maildir/simpleimap.py", line 390, in __len__
    raise Exception('folder %s: %s' % (self.__folder, data[0]))
Exception: folder [Gmail]/All Mail: [TRYCREATE] Specified mailbox does not exist.

This should probably be documented somewhere in the README.

In my case, I'm trying to pull down an Outlook.com address - I can use --remote-folder="FOLDER" to pull down specific folders, but there doesn't seem to be any way to pull down all folders and email?

Is it possible to enable imap2maildir to enumerate all folders from the root, and pull them down? This seems like it might be a useful feature. Apologies if I'm somehow missed it.

victorhooi avatar May 05 '16 04:05 victorhooi

Technically speaking, [Gmail]/All Mail is documented as the default for the --remote-folder option, but I agree it's not entirely clear.  :-) Alas, I'm travelling and don't have the creds to update this right now. (Pull request will be gladly accepted once I'm back home.)

I hadn't considered the multiple folder enumeration case.  Gmail has the All Mail folder, which -- as the name implies -- gets all the mail. I've since moved on to Fastmail, which doesn't have the All Mail but instead has an Archive folder for disposed mail.  This is what I currently point imap2maildir at.

So there's a couple approaches I see:

  1. The Naive Approach: do open_mailbox_*, open_sql_session, and copy_messages_by_folder for each folder.  This will create unique maildirs and SQL caches for each folder.  This would be quick and easy to implement, but might not be ideal for high-churn mailboxes like INBOX, or cases where messages are moved between folders.

  2. The Smarter Approach: use one local mailbox and SQL session for all the folders, and tag each message with the folder it came from (and update the tags on future runs, if the message moves).  I think this would be pretty efficient, because it wouldn't have to download/store messages repeatedly, but it would take some thought and effort to get right.

Depending on your application, the Naive Approach might be good enough. Thoughts/comments?  -rt

On Thu, May 5, 2016, at 00:25, Victor Hooi wrote:

It seems that by default, we assume the IMAP account is Gmail:

Opening sqlite3 database '/Users/victorhooi/Documents/melmail/.imap2maildir.sqlite' Exception! Clearing locks and safing database. Traceback (most recent call last): File "./imap2maildir", line 577, in main seencache=seencache) File "./imap2maildir", line 464, in copy_messages_by_folder outdict['total'] = len(folder) File "/Users/victorhooi/code/imap2maildir/simpleimap.py", line 390, in len raise Exception('folder %s: %s' % (self.folder, data[0])) Exception: folder [Gmail]/All Mail: [TRYCREATE] Specified mailbox does not exist. Traceback (most recent call last): File "./imap2maildir", line 596, in main() File "./imap2maildir", line 577, in main seencache=seencache) File "./imap2maildir", line 464, in copy_messages_by_folder outdict['total'] = len(folder) File "/Users/victorhooi/code/imap2maildir/simpleimap.py", line 390, in __len raise Exception('folder %s: %s' % (self.__folder, data[0])) Exception: folder [Gmail]/All Mail: [TRYCREATE] Specified mailbox does not exist.

This should probably be documented somewhere in the README. In my case, I'm trying to pull down an Outlook.com address - I can use --remote-folder="FOLDER" to pull down specific folders, but there doesn't seem to be any way to pull down all folders and email? Is it possible to enable imap2maildir to enumerate all folders from the root, and pull them down? This seems like it might be a useful feature. Apologies if I'm somehow missed it. — You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub[1]

Links:

  1. https://github.com/rtucker/imap2maildir/issues/27

rtucker avatar May 07 '16 14:05 rtucker