IMAP: save messages locally when they get deleted from server
Solution 1
Until a better solution is found, I guess that the best workaround is to manually archive older messages when needed (e.g. when IMAP server quota limit is approaching). Of course you have to activate messages archiving to a local folder, for each IMAP account (this is necessary to make the "Archive" command button appear when you select messages).
I've also tried some add-on like Awesome Auto Archive and AutoarchiveReloaded, but both were unsatisfactory: the first gave me an error during configuration, the second is safer if run manually.
I hope some day Thunderbird will add a "simple" option for IMAP accounts able to automatically archive older messages when quota limit is approaching. I really wonder why such an important feature for IMAP accounts has not already been implemented.
Solution 2
You can create a Thunderbird filter which moves messages from IMAP folders to local folders.
Anyway an "IMAP archiver and deleter" appears to be a strong need of the Internet Community since at least 10 years, don't know why no solution came out till now. I am currently working at mine here:
My final objectives are:
1) set up an excel workbook which automates the task of deleting bunch of messages and/or donwload them.
2) Convert such workbook to a standalong VBS script for those who do not have MS Office installed.
3) Create a PHP page which performs such task for everybody, regardless of Windows/Mac/Linux
I am at good point for first, the others are still to come.
In the meantime, here they are some useful commands to manually play with you IMAP server:
Connect:
telnet imap.xxxx.yyyy 143 -f log.txt
Login:
. login user pass
List available folders:
. list "" *
Go inside a folder:
. select foldername
Mark messages from 1 to 15 as deleted:
. store 1:15 +FLAGS \Deleted
They will disappear in quite-real-time from Outlook.
Undo above (minus sign):
. store 1:15 -FLAGS \Deleted
(They will come back visible in Outlook).
Move such messages to trash folder (else they are just invisible, not deleted):
. move 1:15 trash
Actually delete the messages:
. select trash
. expunge
You can also past all commands into the telnet window to get them executed:
. select inbox
. store 1:15 +FLAGS \Deleted
. move 1:15 trash
. select trash
. expunge
To avoid "blind deletion" you need to know what's inside those messages from 1st to 15th.
. fetch 1:15 ( flags body[header.fields (subject date)])
Related videos on Youtube
mmj
Updated on September 18, 2022Comments
-
mmj over 1 year
The scenario is:
- an IMAP server with little space (say 1GB)
- quite a few IMAP clients (say 2 phones, 1 tablet, 3 PCs) with an email client such as Thunderbird 38.3 or later
What I'd like to achieve is this:
- all PCs clients should keep a full copy (not just the header) of messages
- all PCs clients should save locally any message deleted remotely (i.e. move full message to a local folder before deleting it from its own IMAP folder, as a result of syncronization)
This way one could save space on IMAP server while keeping a local copy of all (full) messages on each PC (provided that PC clients are syncronized when an email is deleted from a non-PC client -- avoiding deletion from non-PC clients could be a workaround to ensure that local copies are complete).
I found some related questions that address similar scenarios (like this and this), but none gives a solution to this question.
I believe that this is quite a common need, so I hope that some email client guru, hopefully Thunderbird, come up with a solution.
-
emirjonb over 8 yearspossible duplicate: superuser.com/questions/354280/…
-
mmj over 8 years@emirjonb Don't think so, copying all messages from IMAP folder is not the point of my question. In my scenario the IMAP folder has little space, meaning that it can keep (say) few weeks of emails; that's why I need to create a local copy of emails when they are deleted from IMAP folder to make room.
-
emirjonb over 8 yearsok than it is another option on configuring mail client that if you delete from server it won't delete the local mails. Or you can use POP3 on your clients in place of IMAP. POP3 by default download all emails and doesn't delete if the emails are deleted on server, so you can have all your mail locally and manually delete them if needed.
-
emirjonb over 8 yearsfor the first solution link here: superuser.com/questions/369737/…
-
mmj over 8 years@emirjonb I had seen that question/answer, but I could not make it work, because no filter was able to create a local copy of sent emails; the new (Thunderbird 38) "after sent" filter does not work, at least for me on a Gmail account).
-
SΛLVΘ over 8 yearsI'd move on a larger server (like Gmail - no adv intended). You keep your existing address by forwarding from your current mailbox or by server to server POP3 retrieval (again, Gmail can do that in many cases). You can copy / move existing messages on the new account with Thunderbird (it may take a while, but you don't have to sit there while it's happening)
-
mmj over 8 yearsAre you sure that different email clients can use different protocol (IMAP or POP3) with the same email account/server?
-
mmj over 8 yearsEven if I asked for an IMAP solution, I guess POP3 with the "right" configuration (like "leave message on server for not more than 60 days" and, for phones and tablets, "download only header") could be an option, maybe the only option if IMAP management by Thunderbird is so inadequate (e.g. the new "after send" filtering option is not working for me).
-
emirjonb over 8 yearsYes you can use different protocols for different mail-client, but remember if asked during configuration to always check to leave a copy on server
-
mmj over 8 yearsSorry but thinking back on my previous comment I must say that POP3 in NOT an option, because an email client cannot be aware of messsages sent by another email client, since sent messages cannot be uploaded to a POP3 server.
-
jumpjack over 6 yearsIn Thunderbird you can create a local folder and a filter which moves all messages from an IMAP folder to a local folder.