1
0
mirror of https://github.com/imapsync/imapsync.git synced 2024-11-17 00:02:29 +01:00
This commit is contained in:
Nick Bebout 2011-03-12 02:44:53 +00:00
parent 2ed353bb71
commit 2a3f1b08ab
7 changed files with 105 additions and 75 deletions

View File

@ -1,17 +1,30 @@
RCS file: RCS/imapsync,v RCS file: RCS/imapsync,v
Working file: imapsync Working file: imapsync
head: 1.315 head: 1.318
branch: branch:
locks: strict locks: strict
gilles: 1.315 gilles: 1.318
access list: access list:
symbolic names: symbolic names:
keyword substitution: kv keyword substitution: kv
total revisions: 315; selected revisions: 315 total revisions: 318; selected revisions: 318
description: description:
---------------------------- ----------------------------
revision 1.315 locked by: gilles; revision 1.318 locked by: gilles;
date: 2010/07/07 23:44:35; author: gilles; state: Exp; lines: +43 -39
Added --subscribe_all option.
Reviewed and updated inline help.
----------------------------
revision 1.317
date: 2010/07/07 22:49:09; author: gilles; state: Exp; lines: +13 -6
Bug report guideline: upgrade!
----------------------------
revision 1.316
date: 2010/06/29 16:18:09; author: gilles; state: Exp; lines: +10 -11
Typo bandwidth.
----------------------------
revision 1.315
date: 2010/06/11 02:51:54; author: gilles; state: Exp; lines: +8 -6 date: 2010/06/11 02:51:54; author: gilles; state: Exp; lines: +8 -6
*** empty log message *** *** empty log message ***
---------------------------- ----------------------------

4
FAQ
View File

@ -1,5 +1,5 @@
#!/bin/cat #!/bin/cat
# $Id: FAQ,v 1.68 2010/06/22 00:11:56 gilles Exp gilles $ # $Id: FAQ,v 1.69 2010/07/07 22:47:39 gilles Exp gilles $
+------------------+ +------------------+
| FAQ for imapsync | | FAQ for imapsync |
@ -702,7 +702,7 @@ R. Gmail needs SSL
--host2 localhost --host2 localhost
--user2 tata@est.belle \ --user2 tata@est.belle \
--passfile2 /var/tmp/secret.tata \ --passfile2 /var/tmp/secret.tata \
--useheader 'Message-Id' --skipsize --useheader="X-Gmail-Received" --skipsize
If your destination imap server doesn't like "[Gmail]" name, just add If your destination imap server doesn't like "[Gmail]" name, just add
option: option:

27
README
View File

@ -3,7 +3,7 @@ NAME
Synchronise mailboxes between two imap servers. Good at IMAP migration. Synchronise mailboxes between two imap servers. Good at IMAP migration.
More than 32 different IMAP server softwares supported with success. More than 32 different IMAP server softwares supported with success.
$Revision: 1.315 $ $Revision: 1.318 $
INSTALL INSTALL
imapsync works fine under any Unix OS with perl. imapsync works fine under any Unix OS with perl.
@ -66,7 +66,7 @@ SYNOPSIS
[--skipsize] [--allowsizemismatch] [--skipsize] [--allowsizemismatch]
[--delete] [--delete2] [--delete] [--delete2]
[--expunge] [--expunge1] [--expunge2] [--uidexpunge2] [--expunge] [--expunge1] [--expunge2] [--uidexpunge2]
[--subscribed] [--subscribe] [--subscribed] [--subscribe] [--subscribe_all]
[--nofoldersizes] [--nofoldersizes]
[--dry] [--dry]
[--debug] [--debugimap] [--debug] [--debugimap]
@ -108,7 +108,7 @@ OPTIONS
HISTORY HISTORY
I wrote imapsync because an enterprise (basystemes) paid me to install a I wrote imapsync because an enterprise (basystemes) paid me to install a
new imap server without losing huge old mailboxes located on a far away new imap server without losing huge old mailboxes located on a far away
remote imap server accessible by a low bandwith link. The tool imapcp remote imap server accessible by a low bandwidth link. The tool imapcp
(written in python) could not help me because I had to verify every (written in python) could not help me because I had to verify every
mailbox was well transferred and delete it after a good transfer. mailbox was well transferred and delete it after a good transfer.
imapsync started life as a copy_folder.pl patch. The tool copy_folder.pl imapsync started life as a copy_folder.pl patch. The tool copy_folder.pl
@ -201,22 +201,27 @@ AUTHOR
teaching free, open and gratis softwares. Do not hesitate to pay him for teaching free, open and gratis softwares. Do not hesitate to pay him for
that services. that services.
BUGS and BUG REPORT BUG REPORT GUIDELINES
No known serious bug.
Report any bugs or feature requests to the public mailing-list or to the Report any bugs or feature requests to the public mailing-list or to the
author. author.
Help us to help you: follow the following guidelines. Help us to help you: follow the following guidelines.
Read the paper "How To Ask Questions The Smart Way" One time in your life, read the paper "How To Ask Questions The Smart
http://www.catb.org/~esr/faqs/smart-questions.html Way" http://www.catb.org/~esr/faqs/smart-questions.html
Before reporting bugs, read the FAQ, the README and the TODO files. Before reporting bugs, read the FAQ, the README and the TODO files.
http://www.linux-france.org/prj/imapsync/ http://www.linux-france.org/prj/imapsync/
Make a good title, not just "imapsync" or "problem", a good title is Upgrade to last imapsync release, maybe the bug is already fixed.
made of keywords summary, not too long (one visible line).
Upgrade to last Mail-IMAPClient Perl module.
http://search.cpan.org/dist/Mail-IMAPClient/
Make a good title with word "imapsync" in it (my spam filter won't
filter it), Don't write an email title with just "imapsync" or
"problem", a good title is made of keywords summary, not too long (one
visible line).
Don't write imapsync in uppercase in the email title, we'll know you run Don't write imapsync in uppercase in the email title, we'll know you run
windows(tm) and you haven't read the README yet. windows(tm) and you haven't read the README yet.
@ -370,5 +375,5 @@ SIMILAR SOFTWARES
Feedback (good or bad) will always be welcome. Feedback (good or bad) will always be welcome.
$Id: imapsync,v 1.315 2010/06/11 02:51:54 gilles Exp gilles $ $Id: imapsync,v 1.318 2010/07/07 23:44:35 gilles Exp gilles $

3
TIME
View File

@ -1,3 +1,6 @@
80 --subscribe_all. 1.318
70 Risko email. 1.315 on debian.
130 130
180 180
190 Added reconnect to 2.2.9 190 Added reconnect to 2.2.9

21
TODO
View File

@ -1,5 +1,5 @@
#!/bin/cat #!/bin/cat
# $Id: TODO,v 1.74 2010/06/11 02:49:49 gilles Exp gilles $ # $Id: TODO,v 1.76 2010/07/07 23:49:12 gilles Exp gilles $
TODO file for imapsync TODO file for imapsync
---------------------- ----------------------
@ -25,14 +25,13 @@ Add NTLM authentification support
http://cpansearch.perl.org/src/BUZZ/NTLM-1.05/NTLM.pm http://cpansearch.perl.org/src/BUZZ/NTLM-1.05/NTLM.pm
http://curl.haxx.se/rfc/ntlm.html http://curl.haxx.se/rfc/ntlm.html
Add "output to reflect everything that imapsync was doing". Add "output to reflect everything that imapsync was doing".
Not everything but flag synchronization will be nice" Not everything but flag synchronization will be nice"
Add and option to sync to & from files. Add sync imap keywords. Sync gmail labels to imap keyword
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503159
Add an option to make imapsync automatically Add and option to sync to & from files.
reconnect when the connection drops
Add an --aclregextrans2 flag. Add an --aclregextrans2 flag.
"Today we discovered, that Cyrus and Dovecot use different characters for "Today we discovered, that Cyrus and Dovecot use different characters for
@ -40,10 +39,6 @@ their ACLs. Syncing ACLs vom Cyrus to Dovecot (at least 1.2) doesn't
work. Cyrus uses c and d, Dovecot uses k and x instead." work. Cyrus uses c and d, Dovecot uses k and x instead."
Peer Heinlein. Peer Heinlein.
Add --subscribeall option.
Is it possible to have a option that subscribes all folders regardless of
subscription on the source server? Perhaps --subscribeall?
Add a --delete2folders option Add a --delete2folders option
"When syncing mailboxes with imapsync, is there a way to delete folders in the "When syncing mailboxes with imapsync, is there a way to delete folders in the
target account? The --delete2 option only seems to delete individual target account? The --delete2 option only seems to delete individual
@ -150,10 +145,14 @@ http://asg.web.cmu.edu/cyrus/download/imapd/altnamespace.html
Explain expunge behavior. Explain expunge behavior.
DONE. Add --subscribeall option.
Is it possible to have a option that subscribes all folders regardless of
subscription on the source server? Perhaps --subscribeall?
DONE. Add an option to make imapsync automatically
reconnect when the connection drops
DONE. Add Google adsence to imapsync website to see if it can help.
DONE. Be "FLAGS.SILENT" the normal behavior instead of "+FLAGS.SILENT". DONE. Be "FLAGS.SILENT" the normal behavior instead of "+FLAGS.SILENT".

View File

@ -1 +1 @@
1.315 1.318

102
imapsync
View File

@ -9,7 +9,7 @@ tool. Synchronise mailboxes between two imap servers. Good
at IMAP migration. More than 32 different IMAP server softwares at IMAP migration. More than 32 different IMAP server softwares
supported with success. supported with success.
$Revision: 1.315 $ $Revision: 1.318 $
=head1 INSTALL =head1 INSTALL
@ -74,7 +74,7 @@ The option list:
[--skipsize] [--allowsizemismatch] [--skipsize] [--allowsizemismatch]
[--delete] [--delete2] [--delete] [--delete2]
[--expunge] [--expunge1] [--expunge2] [--uidexpunge2] [--expunge] [--expunge1] [--expunge2] [--uidexpunge2]
[--subscribed] [--subscribe] [--subscribed] [--subscribe] [--subscribe_all]
[--nofoldersizes] [--nofoldersizes]
[--dry] [--dry]
[--debug] [--debugimap] [--debug] [--debugimap]
@ -126,7 +126,7 @@ imapsync --help
I wrote imapsync because an enterprise (basystemes) paid me to install I wrote imapsync because an enterprise (basystemes) paid me to install
a new imap server without losing huge old mailboxes located on a far a new imap server without losing huge old mailboxes located on a far
away remote imap server accessible by a low bandwith link. The tool away remote imap server accessible by a low bandwidth link. The tool
imapcp (written in python) could not help me because I had to verify imapcp (written in python) could not help me because I had to verify
every mailbox was well transferred and delete it after a good every mailbox was well transferred and delete it after a good
transfer. imapsync started life as a copy_folder.pl patch. transfer. imapsync started life as a copy_folder.pl patch.
@ -234,22 +234,28 @@ Gilles LAMIRAL earns his living writing, installing,
configuring and teaching free, open and gratis configuring and teaching free, open and gratis
softwares. Do not hesitate to pay him for that services. softwares. Do not hesitate to pay him for that services.
=head1 BUGS and BUG REPORT =head1 BUG REPORT GUIDELINES
No known serious bug.
Report any bugs or feature requests to the public mailing-list Report any bugs or feature requests to the public mailing-list
or to the author. or to the author.
Help us to help you: follow the following guidelines. Help us to help you: follow the following guidelines.
Read the paper "How To Ask Questions The Smart Way" One time in your life, read the paper
"How To Ask Questions The Smart Way"
http://www.catb.org/~esr/faqs/smart-questions.html http://www.catb.org/~esr/faqs/smart-questions.html
Before reporting bugs, read the FAQ, the README and the Before reporting bugs, read the FAQ, the README and the
TODO files. http://www.linux-france.org/prj/imapsync/ TODO files. http://www.linux-france.org/prj/imapsync/
Make a good title, not just "imapsync" or "problem", Upgrade to last imapsync release, maybe the bug
is already fixed.
Upgrade to last Mail-IMAPClient Perl module.
http://search.cpan.org/dist/Mail-IMAPClient/
Make a good title with word "imapsync" in it (my spam filter won't filter it),
Don't write an email title with just "imapsync" or "problem",
a good title is made of keywords summary, not too long (one visible line). a good title is made of keywords summary, not too long (one visible line).
Don't write imapsync in uppercase in the email title, we'll Don't write imapsync in uppercase in the email title, we'll
@ -427,7 +433,7 @@ Entries for imapsync:
Feedback (good or bad) will always be welcome. Feedback (good or bad) will always be welcome.
$Id: imapsync,v 1.315 2010/06/11 02:51:54 gilles Exp gilles $ $Id: imapsync,v 1.318 2010/07/07 23:44:35 gilles Exp gilles $
=cut =cut
@ -475,7 +481,7 @@ my(
$expunge, $expunge1, $expunge2, $uidexpunge2, $dry, $expunge, $expunge1, $expunge2, $uidexpunge2, $dry,
$justfoldersizes, $justfoldersizes,
$authmd5, $authmd5,
$subscribed, $subscribe, $subscribed, $subscribe, $subscribe_all,
$version, $VERSION, $help, $version, $VERSION, $help,
$justconnect, $justfolders, $justbanner, $justconnect, $justfolders, $justbanner,
$fast, $fast,
@ -501,7 +507,7 @@ my(
use vars qw ($opt_G); # missing code for this will be option. use vars qw ($opt_G); # missing code for this will be option.
$rcs = '$Id: imapsync,v 1.315 2010/06/11 02:51:54 gilles Exp gilles $ '; $rcs = '$Id: imapsync,v 1.318 2010/07/07 23:44:35 gilles Exp gilles $ ';
$rcs =~ m/,v (\d+\.\d+)/; $rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1: "UNKNOWN"; $VERSION = ($1) ? $1: "UNKNOWN";
@ -566,8 +572,8 @@ while (@argv_copy) {
my $banner = join("", my $banner = join("",
'$RCSfile: imapsync,v $ ', '$RCSfile: imapsync,v $ ',
'$Revision: 1.315 $ ', '$Revision: 1.318 $ ',
'$Date: 2010/06/11 02:51:54 $ ', '$Date: 2010/07/07 23:44:35 $ ',
"\n",localhost_info(), "\n",localhost_info(),
" and the module Mail::IMAPClient version used here is ", " and the module Mail::IMAPClient version used here is ",
$VERSION_IMAPClient,"\n", $VERSION_IMAPClient,"\n",
@ -729,8 +735,8 @@ $foldersizes = (defined($foldersizes)) ? $foldersizes : 1;
$fastio1 = (defined($fastio1)) ? $fastio1 : 0; $fastio1 = (defined($fastio1)) ? $fastio1 : 0;
$fastio2 = (defined($fastio2)) ? $fastio2 : 0; $fastio2 = (defined($fastio2)) ? $fastio2 : 0;
$reconnectretry1 = (defined($reconnectretry1)) ? $reconnectretry1 : 10; $reconnectretry1 = (defined($reconnectretry1)) ? $reconnectretry1 : 3;
$reconnectretry2 = (defined($reconnectretry2)) ? $reconnectretry2 : 10; $reconnectretry2 = (defined($reconnectretry2)) ? $reconnectretry2 : 3;
@useheader = ("ALL") unless (@useheader); @useheader = ("ALL") unless (@useheader);
@ -1592,7 +1598,7 @@ FOLDER: foreach my $h1_fold (@h1_folders) {
#unless($dry) { $imap2->expunge() }; #unless($dry) { $imap2->expunge() };
} }
if ($subscribe and exists $subscribed_folder{$h1_fold}) { if (($subscribe and exists $subscribed_folder{$h1_fold}) or $subscribe_all) {
print "Subscribing to folder $h2_fold on destination server\n"; print "Subscribing to folder $h2_fold on destination server\n";
unless($dry) { $imap2->subscribe($h2_fold) }; unless($dry) { $imap2->subscribe($h2_fold) };
} }
@ -2085,7 +2091,7 @@ sub stats {
print "Total bytes skipped : $mess_size_total_skipped\n"; print "Total bytes skipped : $mess_size_total_skipped\n";
print "Total bytes error : $mess_size_total_error\n"; print "Total bytes error : $mess_size_total_error\n";
$timediff ||= 1; # No division per 0 $timediff ||= 1; # No division per 0
printf ("Average bandwith rate : %.1f Ko/s\n", $mess_size_total_trans / 1024 / $timediff); printf ("Average bandwidth rate : %.1f KiB/s\n", $mess_size_total_trans / 1024 / $timediff);
print "Detected $error errors\n\n"; print "Detected $error errors\n\n";
print thank_author(); print thank_author();
} }
@ -2096,7 +2102,7 @@ sub thank_author {
"Encourage the author (Gilles LAMIRAL) by giving him a book:\n", "Encourage the author (Gilles LAMIRAL) by giving him a book:\n",
"http://www.amazon.com/gp/registry/wishlist/1C9UNDIH3P7R7/\n", "http://www.amazon.com/gp/registry/wishlist/1C9UNDIH3P7R7/\n",
"or just money via paypal:\n", "or just money via paypal:\n",
"http://www.linux-france.org/prj/imapsync/paypal.html\n")); "http://www.linux-france.org/prj/imapsync/\n"));
} }
sub get_options { sub get_options {
@ -2152,6 +2158,7 @@ sub get_options {
"uidexpunge2!" => \$uidexpunge2, "uidexpunge2!" => \$uidexpunge2,
"subscribed!" => \$subscribed, "subscribed!" => \$subscribed,
"subscribe!" => \$subscribe, "subscribe!" => \$subscribe,
"subscribe_all!" => \$subscribe_all,
"justbanner!" => \$justbanner, "justbanner!" => \$justbanner,
"justconnect!"=> \$justconnect, "justconnect!"=> \$justconnect,
"justfolders!"=> \$justfolders, "justfolders!"=> \$justfolders,
@ -2393,26 +2400,26 @@ Several options are mandatory.
--regexflag <regex> : and this one, etc. --regexflag <regex> : and this one, etc.
--sep1 <string> : separator in case namespace is not supported. --sep1 <string> : separator in case namespace is not supported.
--sep2 <string> : idem. --sep2 <string> : idem.
--delete : delete messages on source imap server after --delete : delete messages on host1 server after
a successful transfer. Useful in case you a successful transfer. Useful in case you
want to migrate from one server to another one. want to migrate from one server to another one.
With imap, delete tags messages as deleted, they With imap, "delete" tags messages as deleted, they
are not really deleted. See expunge. are not really deleted. See expunge.
--delete2 : delete messages on the destination imap server that --delete2 : delete messages on host2 that are not on
are not on the source server. host1 server.
--expunge : expunge messages on source account. --expunge : expunge messages on host1.
expunge really deletes messages marked deleted. expunge really deletes messages marked deleted.
expunge is made at the beginning on the expunge is made at the beginning, on host1 only.
source server only. newly transferred messages Newly transferred messages are expunged if
are expunged if option --expunge is given. option --expunge is given.
no expunge is done on destination account but No expunge is done on destination account
it may change in future releases. (see --expunge2) but it may change in future releases.
--expunge1 : expunge messages on source account. --expunge1 : expunge messages on host1.
--expunge2 : expunge messages on target account. --expunge2 : expunge messages on host2.
--uidexpunge2 : uidexpunge messages on the destination imap server --uidexpunge2 : uidexpunge messages on the destination imap server
that are not on the source server, requires --delete2 that are not on the source server, requires --delete2
--syncinternaldates : sets the internal dates on host2 same as host1. --syncinternaldates : sets the internal dates on host2 same as host1.
Turned on by default. internal date is the date Turned on by default. Internal date is the date
a message arrived on a host (mtime). a message arrived on a host (mtime).
--idatefromheader : sets the internal dates on host2 same as the --idatefromheader : sets the internal dates on host2 same as the
"Date:" headers. "Date:" headers.
@ -2433,15 +2440,17 @@ Several options are mandatory.
--useheader <string> : Use this header to compare messages on both sides. --useheader <string> : Use this header to compare messages on both sides.
Ex: Message-ID or Subject or Date. Ex: Message-ID or Subject or Date.
--useheader <string> and this one, etc. --useheader <string> and this one, etc.
--skipsize : Don't take message size into account. --skipsize : Don't take message size into account to compare
messages on both sides.
--allowsizemismatch : allow RFC822.SIZE != fetched msg size --allowsizemismatch : allow RFC822.SIZE != fetched msg size
consider --skipsize to avoid duplicate messages consider also --skipsize to avoid duplicate messages
when running syncs more than one time per mailbox when running syncs more than one time per mailbox
--dry : do nothing, just print what would be done. --dry : do nothing, just print what would be done.
--subscribed : transfers subscribed folders. --subscribed : transfers subscribed folders.
--subscribe : subscribe to the folders transferred on the --subscribe : subscribe to the folders transferred on the
"destination" server that are subscribed host2 that are subscribed on host1.
on the "source" server. --subscribe_all : subscribe to the folders transferred on the
host2even if they are not subscribed on host1.
--nofoldersizes : Do not calculate the size of each folder in bytes --nofoldersizes : Do not calculate the size of each folder in bytes
and message counts. Default is to calculate them. and message counts. Default is to calculate them.
--justfoldersizes : exit after printed the folder sizes. --justfoldersizes : exit after printed the folder sizes.
@ -2452,21 +2461,22 @@ Several options are mandatory.
--version : print software version. --version : print software version.
--justconnect : just connect to both servers and print useful --justconnect : just connect to both servers and print useful
information. Need only --host1 and --host2 options. information. Need only --host1 and --host2 options.
--justlogin : just login to both servers with users credentials --justlogin : just login to both host1 and host2 with users
and exit. credentials, then exit.
--justfolders : just do things about folders (ignore messages). --justfolders : just do things about folders (ignore messages).
--fast : be faster (just does not sync flags with files --fast : be faster (just does not sync flags of messages
already transfered). already transfered).
--reconnectretry1 <int>: reconnect if connection is lost up to <int> times --reconnectretry1 <int>: reconnect to host1 if connection is lost up to
--reconnectretry2 <int>: reconnect if connection is lost up to <int> times <int> times per imap command (default is 3)
--split1 <int> : split the requests in several parts on source server. --reconnectretry2 <int>: same as --reconnectretry1 but for host2
--split1 <int> : split the requests in several parts on host1.
<int> is the number of messages handled per request. <int> is the number of messages handled per request.
default is like --split1 1000 default is like --split1 1000.
--split2 <int> : same thing on the "destination" server. --split2 <int> : same thing on host2.
--fastio1 : use fastio with the "from" server. --fastio1 : use fastio with host1.
--fastio2 : use fastio with the "destination" server. --fastio2 : use fastio with host2.
--timeout <int> : imap connect timeout. --timeout <int> : imap connect timeout.
--help : print this. --help : print this help.
Example: to synchronise imap account "foo" on "imap.truc.org" Example: to synchronise imap account "foo" on "imap.truc.org"
to imap account "bar" on "imap.trac.org" to imap account "bar" on "imap.trac.org"