How to remove all not downloaded messages from local imap folders?
Hi!
I have Gmail IMAP account with some 10000 messages or so. I downloaded all messages into Thunderbird (at least I thought so) for offline browsing. Then I deleted all messages using web interface. Now I'm trying to move messages from Gmail account in TB to local folders, and divide them by years. I know it's not the best order of actions, but I had to do it this way.
I created local folders structure and started creating filters which suppose to move all messages dated before, say, 01/01/2012 into folder Local Folders/2011. Then next year, etc. etc. Which generally works just fine, BUT: it turns out TB didn't download all messages. Some messages (quite few of them actually) are listed in Inbox or Sent Items, but have no body. It says:
The body of this message has not been downloaded from the server for reading offline. To read this message, you must reconnect to the network, choose Offline from the File menu and then uncheck Work Offline. In the future, you can select which messages or folders to read offline. To do this, choose Offline from the file menu and then select Download/Sync Now. You can adjust the Disk Space preference to prevent the downloading of large messages.
When my filter encounters such message it stops. So I effectively have to click through every single sent and received message to find the undownloaded ones, and delete them. After I do so - filter works fine again. But clicking through 10000 messages is not exactly what you would want to spend your holidays, right?
So the question is: is there a way to automatically find such 'empty' messages and delete them? message filtering would solve the rest of archiving process then. I tried to search for 'The body of this message has not been downloaded ...' text in the message bodies but it didn't work. Naturally, these messages do not seem to have such text- they are just empty, and there's no such search criteria.
Thanks for any clue! Cheers, Anton
Todas as respostas (3)
You have set about this in the wrong order.
If you were to concentrate on moving the messages inside Thunderbird, gmail would look after the server end of things for you. By deleting (at the server) before you reorganized Thunderbird, you have probably deleted all your valuable stuff.
In IMAP, the email client acts as remote viewer, showing you what is on the server. If you remove a message, either at the client or at the server, it disappears from both locations.
If you want it stored locally and not on the server, then the best way to do this is to move the message(s) to local storage, i.e. the Local Folders account in Thunderbird. The removal of the message from the gmail folder signals to gmail that the message has been removed from gmail and so the server deletes its own copy automatically.
I'd go back to gmail and see if you can undelete the deleted messages. They should be lurking in All Mail, if not visible in a bin/trash/deleted folder.
Zenos said
You have set about this in the wrong order.
Yes, I totally agree. But what is done - it's done. I can't undelete the stuff in Gmail, it's already gone. Permanently.
So it all comes down to the initial question: how can I automate the deletion of empty messages (e.g. not downloaded for offline browsing)? Having done that I could easily apply message filters and move the remaining messages to local folders.
There's also a slight chance that the messages that are displayed as not downloaded are actually there. A few times I had situation when, for example, 'Sent Mail' file was of around 5 GB size but TB displayed there were only 50 messages or so. The problem was 'Sent Mail.mfs' file became corrupt. Fortunately I had backup of this .msf file and simple replacement did solve the problem.
But in this case I don't expect there's an easy way to tell if the messages displayed as undownloaded are really absent or it's just another problem with .msf file. Please correct me if I'm wrong.
Thanks anyway and cheers, Anton
There is not a lot stored in an msf file. It's a summary and a record of status, and some cosmetic stuff like column layout. The actual meat of the messages is stored in the accompanying extensionless file e.g Inbox vs Inbox.msf. (This assumes you're using the default mbox mail store method. I haven't yet investigated how it works in the alternative maildir storage system.)
In general, you can delete msf files and they are quietly replaced. Whilst I imagine a corrupt msf file may be a nuisance, it can be safely deleted and the message folder would be re-indexed. I'm surprised that you say restoring an msf file has been useful.
You could work through your mailstore files (e.g. Inbox), looking for occurrences such as
X-Mozilla-Status: 0009
and change them all to:
X-Mozilla-Status: 0000
Actually, the original value isn't of much interest. What you do need to do is change all the non-zero entries to 0.
A good text editor can do this quickly and automatically. If you know what you're doing, you could apply this across all your mailbox files using awk, sed or maybe grep.