Dear all,
at my work I am accessing my emails over imap with my thunderbird as a client.
I would like to ask your help to download my emails (without removing those from the server) in a format that I would be able if needed, to import them back to thunderbird.
My motivation is of course to have a kind of backup of my emails if something happens to the server.
Is there any script that can help me with that ? (kind reminder it should only download emails and not remove those from server)
On 2013-02-04 21:06, alaios wrote:
>
> Dear all,
> at my work I am accessing my emails over imap with my thunderbird as a
> client.
>
> I would like to ask your help to download my emails (without removing
> those from the server) in a format that I would be able if needed, to
> import them back to thunderbird.
>
> My motivation is of course to have a kind of backup of my emails if
> something happens to the server.
> Is there any script that can help me with that ? (kind reminder it
> should only download emails and not remove those from server)
I know how to duplicate imap folders, or the entire server, onto another
imap server, which can be local on your machine. The best tool I found
for this is “imapsync” which is available on the mail server repo IIRC.
I wrote about this in the looking-for forum.
However, posts are saved by thunderbird as a plain mbox folder, which
should be easy to copy to another install just as is. I have done this
with local folders, but not with cached imap folders. So if you tell
Thunderbird to copy your remote imap folders (not move) to a Thunderbird
local folder, and then you save those files elsewhere, you have a backup.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
that part I did not understand.
If I understand it right this script will download me the emails into mbox files and it will not remove any of my emails from the server.
Later on, when needed I can take those mbox files and feed thunderbird. Is not that all?
Alex
IMAP fundamentally does not download copies of messages automatically, only the message header and displays the subject line. Then the User can select to download individual messages On Demand if interesting. One reason to do this is to save bandwidth by not downloading messages if they’re not to be read.
If you want a copy of every message, consider using POP instead, then select whether a copy of messages should be left on the Server or removed when downloaded to the client.
There are probably other options, but this would be the simplest. If you continue to want to use IMAP, it’s like forcing a round peg into a square hole… probably can be done but isn’t ordinarily done.
On 2013-02-04 22:16, alaios wrote:
>
> robin_listas;2524530 Wrote:
>> On 2013-02-04 21:06, alaios wrote:
>> … So if you tell
>> Thunderbird to copy your remote imap folders (not move) to a
>> Thunderbird
>> local folder, and then you save those files elsewhere, you have a
>> backup.
>>
>> …
>
> that part I did not understand.
> If I understand it right this script will download me the emails into
> mbox files and it will not remove any of my emails from the server.
No, I’m not talking of scripts, I’m talking of plain GUI Thunderbird.
Ok, suppose you have an imap account named “account”. Then in
Thunderbird you create a local folder, under the “Local Folders” item.
For example, if the “account” has and ‘inbox’ and ‘sent’ folders then
under “Local Folders” you create a folder named “account”, and two
subfolders named ‘inbox’ and ‘sent’.
Next you copy all messages from the imap “account” to the “Local
Folders/account/” folders, one folder by one.
Is that clear?
Then you take a file browser. There will be a “~/.thunderbird”
directory, and under it a “something.default”, and below it you will see
the “Mail/Local\ Folders\account/*”. The files there will be the mbox
files you have to backup, and the indexes.
Thunderbird is not the only program that can do this. Another one is
Alpine, or even kmail or evolution, with the appropriate variations that
I will not try to describe.
Understood?
Now, I told you of a totally different system, using CLI utility
“imapsync”. You also need to create an imap server on your machine or
use another imap server somewhere to receive the copy.
Is that clear?
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
I make one local folder in thunderbird and than I drag and drop the parent of my imap folders (I have like 15 subfolders) to the local folder made. That will copy email from the imap server (and not remove emails from the server) to the local folder that will also keep the subfolders hierarchy.
Then I go to the subfolder which I consider as a backup. Right?
What would happen after one month when I will select my emails and copy them again to the local folder?
>
> Hi, few questions
> to understand that.
>
> I make one local folder in thunderbird and than I drag and drop the
> parent of my imap folders (I have like 15 subfolders)
No, you select one subfolder, mark all the emails, right click, copy,
select destination folder. Pick next folder, iterate.
> Then I go to the subfolder which I consider as a backup. Right?
>
> What would happen after one month when I will select my emails and copy
> them again to the local folder?
If you copy the emails to the same folder you get duplicated copies,
there is no detection of duplicates. Thus pick a new folder, verify,
delete the old one.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
Thanks for the answer.
I would like then to try some scripting for that. So to have a bash script running with crontab that would download, and compress those files.
On 2013-02-05 14:56, alaios wrote:
>
> Thanks for the answer.
> I would like then to try some scripting for that. So to have a bash
> script running with crontab that would download, and compress those
> files.
The only scriptable solution I found (imapsync), that works, can copy
emails from one imap server to another imap server, which can be on your
machine, of course. I use dovecot. You can, of course, with a local
dovecot stop the server process, copy the files away to a tar archive,
then restart the server again, if wanted.
I found other solutions, but this is the only program I found that
worked. Please read the forum thread I started on this search in the
looking-for subforum. For example, the web page of “imapsync” (it is a
commercial product with an opensource version that is available on our
repos) has a section with a list of other similar products which I found
very useful. I remember seeing programs that claimed to be able to clone
remote imap folders to local mbox files, and this is what you need.
But as I said, I could not manage to make any of those solutions to
work, maybe you can succeed where I did not. I would be very interested
in this if you can manage it.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
that worked nice.
Some time ago during execution time I get a python error
Finding Folders -Traceback (most recent call last):
File "/home/backup-email/imapbackup.py", line 658, in <module>
main()
File "/home/backup-email/imapbackup.py", line 551, in main
names = get_names(server, config'compress'])
File "/home/backup-email/imapbackup.py", line 340, in get_names
lst = parse_list(row)
File "/home/backup-email/imapbackup.py", line 303, in parse_list
row = row.strip()
AttributeError: 'tuple' object has no attribute 'strip'
I hope tomorrow I will have more time to explore also the scripting alternatives.