This commit is contained in:
Nick Bebout 2011-03-12 02:44:20 +00:00
parent 00a0bc81fd
commit ab8d0b0cf7
8 changed files with 167 additions and 44 deletions

11
CREDITS
View file

@ -1,10 +1,17 @@
#!/bin/cat
Sven Havemann
Moved from Braunschweig to Graz and asked
how to move Braunschweig mail sorted into
a folder INBOX.Braunschweig
See FAQ.
Vincent Deffontaines
Made me talk about --exclude 'fold1|fold2|f3'
Jim Rosenberg
Had problems with dbmail.
Had problems with dbmail 2.0.7.
Gave up too early with bad feedback :-)
Thomas Stegbauer
Suggested the mailing list creation.
@ -15,7 +22,7 @@ Made me wrote the learn/subscribe script example.
René Pfeiffer
Paid me 100 euros for just an imapsync success story
and little help from me. René also wrote a LinuxGazette
article about imapsync in april/may 2006
article about imapsync in march 2006
Mike
Gave "Mdaemon 8.1" success story.

View file

@ -1,17 +1,29 @@
RCS file: RCS/imapsync,v
Working file: imapsync
head: 1.149
head: 1.152
branch:
locks: strict
gilles: 1.149
access list:
symbolic names:
keyword substitution: kv
total revisions: 149; selected revisions: 149
total revisions: 152; selected revisions: 152
description:
----------------------------
revision 1.149 locked by: gilles;
revision 1.152
date: 2006/02/17 02:57:21; author: gilles; state: Exp; lines: +55 -18
Made the --justconnect a real "just connect" connection,
not a auth connection like it is now.
----------------------------
revision 1.151
date: 2006/02/17 01:28:57; author: gilles; state: Exp; lines: +9 -6
Added documentation about --regextrans2, dry mode.
----------------------------
revision 1.150
date: 2006/02/16 05:23:05; author: gilles; state: Exp; lines: +9 -7
DBMail 2.0.7 failure story
----------------------------
revision 1.149
date: 2006/02/14 00:44:44; author: gilles; state: Exp; lines: +9 -8
Documented --exclude 'fold1|fold2|f3'
----------------------------

32
FAQ
View file

@ -44,6 +44,38 @@ b) Use stunnel
then use imapsync on localhost (or bar machine) imap (143) port.
======================================================================
Q. I have moved from Braunschweig to Graz, so I would like to have my whole
Braunschweig mail sorted into a folder INBOX.Braunschweig of my new mail
account.
R.
1) First try (safe mode):
imapsync \
...
--regextrans2 's/INBOX(.*)/INBOX.Braunschweig$1/' \
--dry --justfolders
2) See if the output says everything you want imapsync to do,
--dry option is safe and does nothing real.
3) Remove --dry
Check the imap folder tree on the target side
4) Remove --justfolders
=======================================================================
Q. Give examples about --regextrans2
R. Examples:
1) To remove INBOX. in the name of destination folders:
--regextrans2 's/^INBOX\.(.+)/$1/'
2) To sync a complete account in a subfolder called FOO:
--regextrans2 's/^INBOX(.*)/INBOX.FOO$1/'
=======================================================================
Q. I'm migrating from WU to Cyrus, and the mail folders are
under /home/user/mail but the tool copies everything in

24
README
View file

@ -2,7 +2,7 @@ NAME
imapsync - IMAP synchronization, copy or migration tool. Synchronize
mailboxes between two imap servers. Good at IMAP migration.
$Revision: 1.149 $
$Revision: 1.152 $
INSTALL
imapsync works fine under any Unix OS.
@ -36,21 +36,21 @@ SYNOPSIS
[--folder <string> --folder <string> ...]
[--include <regex>] [--exclude <regex>]
[--prefix2 <string>] [--prefix1 <string>]
[--regextrans2 <regex> --regextrans2 <regex> ...]
[--regextrans2 <regex> --regextrans2 <regex> ...]
[--sep1 <char>]
[--sep2 <char>]
[--justfolders] [--justconnect]
[--justfolders] [--justfoldersizes] [--justconnect]
[--syncinternaldates]
[--buffersize <int>]
[--syncacls]
[--regexmess <regex>] [--regexmess <regex>]
[--regexmess <regex>] [--regexmess <regex>]
[--maxsize <int>]
[--maxage <int>]
[--minage <int>]
[--skipheader <regex>]
[--useheader <string>] [--useheader <string>]
[--skipsize]
[--delete] [--expunge] [--expunge1] [--expunge2]
[--delete] [--expunge] [--expunge1] [--expunge2]
[--subscribed] [--subscribe]
[--nofoldersizes]
[--dry]
@ -167,9 +167,11 @@ BUGS
Report any bugs to the author: lamiral@linux-france.org
IMAP SERVERS
Failure story reported with the following imap server :
Failure stories reported with the following imap servers :
- MailEnable 1.54 (Proprietary) http://www.mailenable.com/
- MailEnable 1.54 (Proprietary) http://www.mailenable.com/
- DBMail 2.0.7 (GPL). But DBMail 1.2.1 works.
Patient and confident testers are welcome.
Success stories reported with the following imap servers (softwares
names are in alphabetic order) :
@ -182,7 +184,7 @@ IMAP SERVERS
- Cyrus IMAP 1.5, 1.6, 2.1, 2.1.15, 2.1.16, 2.1.18
2.2.1, 2.2.2-BETA, 2.2.10, 2.2.12, 2.3-alpha (OSI Approved)
(http://asg.web.cmu.edu/cyrus/)
- DBMail 1.2.1 (GPL) (http://www.dbmail.org/)
- DBMail 1.2.1 (GPL) (http://www.dbmail.org/). 2.0.7 seems buggy.
- Dovecot 0.99.10.4 0.99.14 (LGPL) (http://www.dovecot.org/)
- Domino (Notes) 6.5, 5.0.6, 5.0.7
- Groupwise IMAP (Novell). Buggy so see the FAQ.
@ -210,7 +212,9 @@ IMAP SERVERS
From software :* OK louloutte Cyrus IMAP4 v1.5.19 server ready
To software :* OK Courier-IMAP ready
You can use option --justconnect to get those lines.
You can use option --justconnect to get those lines. Example :
imapsync --host1 imap.troc.org --host2 imap.trac.org --justconnect
And please rate imapsync at http://freshmeat.net/projects/imapsync/
@ -263,5 +267,5 @@ AUTHOR
teaching free open and gratis softwares. Don't hesitate to pay him for
that services.
$Id: imapsync,v 1.149 2006/02/14 00:44:44 gilles Exp gilles $
$Id: imapsync,v 1.152 2006/02/17 02:57:21 gilles Exp $

16
TODO
View file

@ -2,6 +2,10 @@ TODO file for imapsync
----------------------
Make --include --exclude options possibly be a list.
Create a imapsync mailing list.
Add features from Herman (patch against 1.139)
@ -31,9 +35,6 @@ Talk about :
(netscape or thunderbird is ok with dates)
use the option --syncinternaldates "
Add usage about --regextrans2
To remove INBOX. in the name of destination folders :
--regextrans2 's/^INBOX\.(.+)/$1/'
Add cyrus link about INBOX. namespace
http://asg.web.cmu.edu/cyrus/download/imapd/altnamespace.html
@ -45,6 +46,15 @@ Explain expunge behavior
Add a --recurse option when --folder option is used.
DONE. Add usage about --regextrans2
To remove INBOX. in the name of destination folders:
--regextrans2 's/^INBOX\.(.+)/$1/'
To sync a complete account in a subfolder called FOO:
--regextrans2 's/^INBOX(.*)/INBOX.FOO$1/'
DONE. Make the --justconnect a real "just connect" connection,
not a auth connection like it is now.
DONE. Add --prefix1 option. Don't know what is the need exactly.
The need is to remove this prefix when building target folder names.

View file

@ -1 +1 @@
1.149
1.152

View file

@ -6,7 +6,7 @@ imapsync - IMAP synchronization, copy or migration
tool. Synchronize mailboxes between two imap servers. Good
at IMAP migration.
$Revision: 1.149 $
$Revision: 1.152 $
=head1 INSTALL
@ -42,21 +42,21 @@ $Revision: 1.149 $
[--folder <string> --folder <string> ...]
[--include <regex>] [--exclude <regex>]
[--prefix2 <string>] [--prefix1 <string>]
[--regextrans2 <regex> --regextrans2 <regex> ...]
[--regextrans2 <regex> --regextrans2 <regex> ...]
[--sep1 <char>]
[--sep2 <char>]
[--justfolders] [--justconnect]
[--justfolders] [--justfoldersizes] [--justconnect]
[--syncinternaldates]
[--buffersize <int>]
[--syncacls]
[--regexmess <regex>] [--regexmess <regex>]
[--regexmess <regex>] [--regexmess <regex>]
[--maxsize <int>]
[--maxage <int>]
[--minage <int>]
[--skipheader <regex>]
[--useheader <string>] [--useheader <string>]
[--skipsize]
[--delete] [--expunge] [--expunge1] [--expunge2]
[--delete] [--expunge] [--expunge1] [--expunge2]
[--subscribed] [--subscribe]
[--nofoldersizes]
[--dry]
@ -192,9 +192,11 @@ Report any bugs to the author: lamiral@linux-france.org
=head1 IMAP SERVERS
Failure story reported with the following imap server :
Failure stories reported with the following imap servers :
- MailEnable 1.54 (Proprietary) http://www.mailenable.com/
- MailEnable 1.54 (Proprietary) http://www.mailenable.com/
- DBMail 2.0.7 (GPL). But DBMail 1.2.1 works.
Patient and confident testers are welcome.
Success stories reported with the following imap servers
(softwares names are in alphabetic order) :
@ -207,7 +209,7 @@ Success stories reported with the following imap servers
- Cyrus IMAP 1.5, 1.6, 2.1, 2.1.15, 2.1.16, 2.1.18
2.2.1, 2.2.2-BETA, 2.2.10, 2.2.12, 2.3-alpha (OSI Approved)
(http://asg.web.cmu.edu/cyrus/)
- DBMail 1.2.1 (GPL) (http://www.dbmail.org/)
- DBMail 1.2.1 (GPL) (http://www.dbmail.org/). 2.0.7 seems buggy.
- Dovecot 0.99.10.4 0.99.14 (LGPL) (http://www.dovecot.org/)
- Domino (Notes) 6.5, 5.0.6, 5.0.7
- Groupwise IMAP (Novell). Buggy so see the FAQ.
@ -237,6 +239,9 @@ are useful to know the softwares. Example:
To software :* OK Courier-IMAP ready
You can use option --justconnect to get those lines.
Example :
imapsync --host1 imap.troc.org --host2 imap.trac.org --justconnect
And please rate imapsync at http://freshmeat.net/projects/imapsync/
@ -308,7 +313,7 @@ Gilles LAMIRAL earn his living writing, installing,
configuring and teaching free open and gratis
softwares. Don't hesitate to pay him for that services.
$Id: imapsync,v 1.149 2006/02/14 00:44:44 gilles Exp gilles $
$Id: imapsync,v 1.152 2006/02/17 02:57:21 gilles Exp $
=cut
@ -337,7 +342,8 @@ my(
$maxsize, $maxage, $minage,
$skipheader, @useheader,
$skipsize, $foldersizes, $buffersize,
$delete, $expunge, $expunge1, $expunge2, $dry,
$delete, $expunge, $expunge1, $expunge2, $dry,
$justfoldersizes,
$authmd5,
$subscribed, $subscribe,
$version, $VERSION, $help,
@ -355,7 +361,7 @@ my(
use vars qw ($opt_G); # missing code for this will be option.
$rcs = ' $Id: imapsync,v 1.149 2006/02/14 00:44:44 gilles Exp gilles $ ';
$rcs = ' $Id: imapsync,v 1.152 2006/02/17 02:57:21 gilles Exp $ ';
$rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1 : "UNKNOWN";
@ -392,8 +398,8 @@ $error=0;
my $banner = join("",
'$RCSfile: imapsync,v $ ',
'$Revision: 1.149 $ ',
'$Date: 2006/02/14 00:44:44 $ ',
'$Revision: 1.152 $ ',
'$Date: 2006/02/17 02:57:21 $ ',
"\n",
"Mail::IMAPClient version used here is ",
$VERSION_IMAPClient,"\n"
@ -414,10 +420,37 @@ sub missing_option {
$host1 || missing_option("--host1") ;
$port1 = (defined($port1)) ? $port1 : 143;
$user1 || missing_option("--user1");
$host2 || missing_option("--host2") ;
$port2 = (defined($port2)) ? $port2 : 143;
sub connect_imap {
my($host, $port, $debugimap) = @_;
my $imap = Mail::IMAPClient->new();
$imap->Server($host);
$imap->Port($port);
$imap->Debug($debugimap);
$imap->connect()
or die "Can not open imap connection on [$host] : $@\n";
}
if ($justconnect) {
my $from = ();
my $to = ();
$from = connect_imap($host1, $port1);
print "From software : ", ($from->Report())[0];
print "From capability : ", join(" ", $from->capability()), "\n";
$to = connect_imap($host2, $port2);
print "To software : ", ($to->Report())[0];
print "To capability : ", join(" ", $to->capability()), "\n";
$from->logout();
$to->logout();
exit(0);
}
$user1 || missing_option("--user1");
$user2 || missing_option("--user2");
$authmd5 = (defined($authmd5)) ? $authmd5 : 1;
@ -532,6 +565,8 @@ sub md5auth() {
}
print "From software : ", ($from->Report())[0];
print "To software : ", ($to->Report())[0];
@ -705,7 +740,7 @@ sub timenext {
return($timerel);
}
exit if ($justconnect);
exit if ($justfoldersizes);
# needed for setting flags
my $tohasuidplus = $to->has_capability("UIDPLUS");
@ -1011,6 +1046,8 @@ FOLDER: foreach my $f_fold (@f_folders) {
print "Time : ", timenext(), " s\n";
}
$from->logout();
$to->logout();
$timeend = time();
@ -1106,6 +1143,7 @@ sub get_options
"subscribe!" => \$subscribe,
"justconnect!"=> \$justconnect,
"justfolders!"=> \$justfolders,
"justfoldersizes!" => \$justfoldersizes,
"fast!" => \$fast,
"version" => \$version,
"help" => \$help,
@ -1230,6 +1268,9 @@ Several options are mandatory.
have NAMESPACE capability.
--regextrans2 <regex> : Apply the whole regex to each destination folders.
--regextrans2 <regex> : and this one. etc.
When you play with the --regextrans2 option, first
add also the safe options --dry --justfolders
Then, when happy, remove --dry, remove --justfolders
--regexmess <regex> : Apply the whole regex to each message before transfer.
Exemple : 's/\\000/ /g' # to replace null by space.
--regexmess <regex> : and this one.
@ -1275,14 +1316,15 @@ Several options are mandatory.
on the "source" server.
--(no)foldersizes : Calculate the size of each "From" folder in bytes
and message counts. Meant to be used with
--justconnect. Turned on by default.
--justfoldersizes. Turned on by default.
--justfoldersizes : exit after printed the folder sizes.
--syncacls : Synchronizes acls (Access Control Lists).
--nosyncacls : Does not synchronize acls. This is the default.
--debug : debug mode.
--debugimap : imap debug mode.
--version : print sotfware version.
--justconnect : just connect to both servers and print useful
information.
information. Need only --host1 and --host2 options.
--justfolders : just do things about folders (ignore messages).
--fast : be faster (does not sync flags).
--nofastio1 : don't use fastio with the "from" server.
@ -1294,7 +1336,7 @@ Example: to synchronise imap account "foo" on "imap.truc.org"
to imap account "bar" on "imap.trac.org"
$0 \\
--host1 imap.troc.org --user1 foo --passfile1 /etc/secret1 \\
--host1 imap.truc.org --user1 foo --passfile1 /etc/secret1 \\
--host2 imap.trac.org --user2 bar --passfile2 /etc/secret2

View file

@ -1,6 +1,6 @@
#!/bin/sh
# $Id: tests.sh,v 1.44 2005/11/28 01:27:44 gilles Exp $
# $Id: tests.sh,v 1.45 2006/02/17 02:51:12 gilles Exp gilles $
#### Shell pragmas
@ -266,17 +266,32 @@ lp_justconnect()
{
if test X`hostname` = X"plume"; then
echo3 Here is plume
./imapsync \
--host2 plume --user2 tata@est.belle \
--passfile2 /var/tmp/secret.tata \
--host1 loul --user1 tata \
--passfile1 /var/tmp/secret.tata \
./imapsync \
--host2 plume \
--host1 loul \
--justconnect
else
:
fi
}
lp_justfoldersizes()
{
if test X`hostname` = X"plume"; then
echo3 Here is plume
./imapsync \
--host2 plume --user2 tata@est.belle \
--passfile2 /var/tmp/secret.tata \
--host1 loul --user1 tata \
--passfile1 /var/tmp/secret.tata \
--justfoldersizes
else
:
fi
}
lp_authmd5()
{
if test X`hostname` = X"plume"; then
@ -705,6 +720,7 @@ test $# -eq 0 && run_tests \
lp_subscribed \
lp_subscribe \
lp_justconnect \
lp_justfoldersizes \
lp_authmd5 \
lp_maxage \
lp_maxsize \