[NTLUG:Discuss] Copying all email/folders between two IMAP accounts auto-magically

David Simmons dave at dgnal.net
Fri Apr 10 22:58:47 CDT 2009



> Guys - subject says it all...does anyone have any howto's to
automatically
> copy / rsync two IMAP email accounts?  I'm
using ThunderBird with the
> two accounts - but Thunderbird only
let's me manually do one folder at a
> time....what a drag!?

Yes - that is a drag....but doing a little research will reveal
the 'imapsync' command (it's probably in your apt-get / yum install system
already).

By installing that tool - you can do what you're
asking (automagically sync two off-site email accounts using
IMAP).....here's  the command-line you'll probably need to use:

imapsync --buffersize 8192000 --host1 mail.server.net --user1
user at server.net --password1 agreatpassword --ssl1 --sep1 . --prefix1
INBOX. --host2 imap.server2.com --user2 same_dude at server2.com --password2
areallygreatpassword --ssl2 --noauthmd5 --subscribed --subscribe
--syncinternaldates

Let me break it down for you....basically
you give the information about the two accounts (the host1, user1,
password1, host2, user2, password2 entries).  Talk about how the
accounts connect (in this case...they use SSL - which also sets the port
to use, and noauthmd5 talks about the authentication method used).

The subscribed and subscribe tell the command to copy over the
folders/email that is currently subscribed to on server1....duplicate it
on server2....and subscribe to those folders/email on server2 for you.

OH.....that weird '--sep1 . --prefix INBOX.' tells the command how
your existing mail is deliniated within it's MailDir / Folders.....if you
don't have those set correctly (or leave them empty) - you'll get a nasty
"No NAMESPACE capability in imap server".  You may need to
Google with that error to find some methods of how to determine what the
appropriate things use are.

HTH,

-dave






More information about the Discuss mailing list