1
0
mirror of https://github.com/imapsync/imapsync.git synced 2024-11-16 15:52:47 +01:00
This commit is contained in:
Nick Bebout 2013-09-26 16:59:52 -05:00
parent ce9d0bd3d8
commit c555c31229
20 changed files with 3449 additions and 2577 deletions

View File

@ -1,17 +1,58 @@
RCS file: RCS/imapsync,v
Working file: imapsync
head: 1.555
head: 1.564
branch:
locks: strict
gilles: 1.555
gilles: 1.564
access list:
symbolic names:
keyword substitution: kv
total revisions: 555; selected revisions: 555
total revisions: 564; selected revisions: 564
description:
----------------------------
revision 1.555 locked by: gilles;
revision 1.564 locked by: gilles;
date: 2013/08/18 19:28:47; author: gilles; state: Exp; lines: +114 -22
Adapted behavior for allowing --maxdate --mindate with --noabletosearch. Use internat date instead of Date: header.
----------------------------
revision 1.563
date: 2013/08/16 00:59:30; author: gilles; state: Exp; lines: +8 -7
Added QQMail success.
----------------------------
revision 1.562
date: 2013/08/16 00:41:48; author: gilles; state: Exp; lines: +38 -16
Speed fix. Does not resync the flags when flags on host2 do not respect RFC. \Seen -> \SEEN. imapsync detects this as same flag.
Atmail 6.x [host1] success.
Fix for QQMail IMAP4Server. With --noabletosearch the previous fetch with 1:999999 is replaced by an uidnext request.
----------------------------
revision 1.561
date: 2013/08/09 23:49:23; author: gilles; state: Exp; lines: +15 -8
Added --timeout in the --help output.
Default timeout is 120 seconds now (was nothing by imapsync, 600 with underlying modules).
----------------------------
revision 1.560
date: 2013/08/09 23:06:04; author: gilles; state: Exp; lines: +7 -7
Added --addheader suggestion for messages with no header found.
----------------------------
revision 1.559
date: 2013/08/06 11:33:53; author: gilles; state: Exp; lines: +7 -7
Apply same treatment to --delete2duplicates as --delete2. If --uidexpunge2 can be done, do it, else do --expunge2 (unless --nouidexpunge2 or --noexpunge2).
----------------------------
revision 1.558
date: 2013/08/03 01:13:37; author: gilles; state: Exp; lines: +18 -16
Bugfix. SSL_version was not well treated.
----------------------------
revision 1.557
date: 2013/08/01 19:28:09; author: gilles; state: Exp; lines: +7 -7
Bugfix. max_line_length('a') was wrong.
----------------------------
revision 1.556
date: 2013/08/01 00:10:03; author: gilles; state: Exp; lines: +42 -28
Added --ssl1_SSL_version ssl2_SSL_version option to change default SSL_version.
For example --ssl2_SSL_version SSLv3 fix connection to cmail.cmich.edu on Windows.
Fixed a warning about regex with \E on Perl >= 5.16
----------------------------
revision 1.555
date: 2013/07/23 11:41:10; author: gilles; state: Exp; lines: +7 -6
Fix warning for extract_header()
----------------------------

29
FAQ
View File

@ -1,5 +1,5 @@
#!/bin/cat
# $Id: FAQ,v 1.136 2013/08/03 02:07:30 gilles Exp gilles $
# $Id: FAQ,v 1.138 2013/08/16 01:03:32 gilles Exp gilles $
+------------------+
| FAQ for imapsync |
@ -181,7 +181,7 @@ R. Search the internet.
Q. Is is legal to find imapsync gratis (or not) elsewhere?
R. Yes, the license permits it
http://imapsync.lamiral.info/LICENSE
http://imapsync.lamiral.info/NOLIMIT
=======================================================================
Q. I use --useuid which uses a cache in /tmp or --tmpdir, the hostnames
@ -798,15 +798,24 @@ R. Use imapsync release 1.172 or at least 1.166 with options
or a old old imapsync (before 1.94)
=======================================================================
Q. Does imapsync support IMAP over TLS (IMAPS)?
Q. Does imapsync support IMAP TLS?
R. Use --tls1 and/or --tls2 options
--tls1 tells imapsync to use tls on host1.
--tls2 tells imapsync to use tls on host2.
=======================================================================
Q. Does imapsync support IMAP over SSL (IMAPS)?
R. Yes natively since release 1.161.
still, 2 ways, at least :
a) Use --ssl1 and/or --ssl2 options
a) Use native --ssl1 and/or --ssl2 options
--ssl1 tells imapsync to use ssl on host1
--ssl2 tells imapsync to use ssl on host2
--ssl1 tells imapsync to use ssl on host1.
--ssl2 tells imapsync to use ssl on host2.
b) Use stunnel
@ -817,6 +826,8 @@ b) Use stunnel
or using names instead of numbers
stunnel -c -d 143 -r imap.foo.org:993
then use imapsync on localhost (or bar machine) imap (143) port.
If the local port 143 is already taken then use a free one, 10143.
=======================================================================
Q. On windows ssl use to work with imapsync.exe 1.536 or previous then
@ -1770,6 +1781,12 @@ imapsync ... --sep1 '.' --prefix1 '' \
--noabletosearch --nocheckmessageexists --addheader
(Thanks to Andrew Tucker)
======================================================================
Q. From or to QQMail IMAP4Server
R. imapsync ... --noabletosearch
======================================================================
Q: How can I write an .rpm with imapsync

159
GOOD_PRACTICES.html Normal file
View File

@ -0,0 +1,159 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
</HEAD><BODY BGCOLOR="white" TEXT="black">
<FONT SIZE="4">
</FONT></CENTER>
<P></P>
<HR NOSHADE SIZE=1>
<P></P>
<UL>
<LI><A HREF="#toc1">Best practices for imapsync</A>
<UL>
<LI><A HREF="#toc2">Simple transfer</A>
<LI><A HREF="#toc3">Exact backup</A>
<LI><A HREF="#toc4">Restore</A>
<LI><A HREF="#toc5">Presync</A>
</UL>
</UL>
<P></P>
<HR NOSHADE SIZE=1>
<P></P>
<A NAME="toc1"></A>
<H1>Best practices for imapsync</H1>
<P>
You are not supposed to have read the TUTORIAL documentation but it
reading it should help to understand and master the following best practices.
</P>
<A NAME="toc2"></A>
<H2>Simple transfer</H2>
<P>
By principle, imapsync does not change any single byte of messages,
unless --regexmess or --addheader is used.
But since imapsync identifies messages with "Message-Id" and "Received" headers,
it ignores messages that lack those headers;
most of the time it happens with the "Sent" folders.
A way to sync those messages is to add option --addheader.
Before appending a message on host2, and only when needed,
--addheader option adds a Message-Id header like "Message-Id: &lt;123456789@imapsync&gt;"
where 123456789 is the host1 folder message UID. Messages on host1 stay untouched.
This way, multiples runs will not generate duplicates as long as UIDs stay
the same on host1, which is the case for most imap servers.
</P>
<P>
Unix:
</P>
<PRE>
imapsync \
--host1 imap.truc.org --user1 foo --password1 secret1 \
--host2 imap.trac.org --user2 bar --password2 secret2 \
--addheader
</PRE>
<P>
Windows:
</P>
<PRE>
imapsync ^
--host1 imap.truc.org --user1 foo --password1 secret1 ^
--host2 imap.trac.org --user2 bar --password2 secret2 ^
--addheader
</PRE>
<P></P>
<A NAME="toc3"></A>
<H2>Exact backup</H2>
<P>
Assertions for this example:
</P>
<UL>
<LI>The target account at host2 is considered like inactive.
<LI>Everything a user does on host1 will be synced, folders, messages, flags.
<LI>Everything a user does on host2 will be erased by the sync.
<P></P>
Two options are good for an exact backup, --delete2 and --delete2folders.
<P></P>
<LI>--delete2: deletes messages in host2 that are not in host1 server.
<LI>--delete2folders: deletes folders in host2 that are not in host1 server.
<P></P>
Unix:
<PRE>
imapsync \
--host1 imap.truc.org --user1 foo --password1 secret1 \
--host2 imap.trac.org --user2 bar --password2 secret2 \
--delete2 --delete2folders
</PRE>
Windows:
<PRE>
imapsync ^
--host1 imap.truc.org --user1 foo --password1 secret1 ^
--host2 imap.trac.org --user2 bar --password2 secret2 ^
--delete2 --delete2folders
</PRE>
</UL>
<P>
Have in mind
</P>
<UL>
<LI>Backupping without restoring at least one time to check the process
is like pissing in a violin or throwing away your messages.
<LI>Manual backups are useless, this way you will never have the ones you need to restore.
<LI>Automatic backups are the way to go. They never forget to start. They may fail.
<LI>Automatic backups can fail. How? Hard disks get fully filled, they crash. Networks fail too.
<LI>Monitor the backups.
<LI>Remenber you have backups.
<LI>Document the restoring process or consider the backup is a just a lost trash.
<LI>Think twice at least before running any restoring command.
</UL>
<A NAME="toc4"></A>
<H2>Restore</H2>
<P>
Restoring is not the exact reverse of backupping
since between a backup and a mistake, the context has changed,
some things went wrong but not all, for examples new messages arrived.
So synchronize an active account identical from a backup might not be the best idea.
</P>
<P>
The context can be a crash or equivalent like some if a
bad admin or service closed definitevely access to your messages.
Even in that case an exact restore, with --delete2 --delete2folders, should not be ok,
just because new messages arrive in INBOX all the time.
Plus, if the mailbox is a brand new one then --delete2 --delete2folders options are useless,
since there is nothing to delete.
</P>
<A NAME="toc5"></A>
<H2>Presync</H2>
<P>
Presync is like a backup except deleting folders on host2 that
are not on host1 is not always wanted. Presync means a new
different imap server will host messages and folders.
Often this new imap server has predefined folders that
should be kept for proper use, so I suggest to not use
option --delete2folders.
</P>
<P>
Unix:
</P>
<PRE>
imapsync \
--host1 imap.truc.org --user1 foo --password1 secret1 \
--host2 imap.trac.org --user2 bar --password2 secret2 \
--delete2
</PRE>
<P>
Windows:
</P>
<PRE>
imapsync ^
--host1 imap.truc.org --user1 foo --password1 secret1 ^
--host2 imap.trac.org --user2 bar --password2 secret2 ^
--delete2
</PRE>
<P></P>
<!-- html code generated by txt2tags 2.5 (http://txt2tags.sf.net) -->
<!-- cmdline: txt2tags -i GOOD_PRACTICES.t2t -t html -\-toc -o GOOD_PRACTICES.html -->
</BODY></HTML>

129
GOOD_PRACTICES.t2t Normal file
View File

@ -0,0 +1,129 @@
% $Id: GOOD_PRACTICES.t2t,v 1.5 2013/08/16 01:12:21 gilles Exp gilles $
= Best practices for imapsync =
You are not supposed to have read the TUTORIAL documentation but it
reading it should help to understand and master the following best practices.
== Simple transfer ==
By principle, imapsync does not change any single byte of messages,
unless --regexmess or --addheader is used.
But since imapsync identifies messages with "Message-Id" and "Received" headers,
it ignores messages that lack those headers;
most of the time it happens with the "Sent" folders.
A way to sync those messages is to add option --addheader.
Before appending a message on host2, and only when needed,
--addheader option adds a Message-Id header like "Message-Id: <123456789@imapsync>"
where 123456789 is the host1 folder message UID. Messages on host1 stay untouched.
This way, multiples runs will not generate duplicates as long as UIDs stay
the same on host1, which is the case for most imap servers.
Unix:
```
imapsync \
--host1 imap.truc.org --user1 foo --password1 secret1 \
--host2 imap.trac.org --user2 bar --password2 secret2 \
--addheader
```
Windows:
```
imapsync ^
--host1 imap.truc.org --user1 foo --password1 secret1 ^
--host2 imap.trac.org --user2 bar --password2 secret2 ^
--addheader
```
== Exact backup ==
Assertions for this example:
- The target account at host2 is considered like inactive.
- Everything a user does on host1 will be synced, folders, messages, flags.
- Everything a user does on host2 will be erased by the sync.
Two options are good for an exact backup, --delete2 and --delete2folders.
- --delete2: deletes messages in host2 that are not in host1 server.
- --delete2folders: deletes folders in host2 that are not in host1 server.
Unix:
```
imapsync \
--host1 imap.truc.org --user1 foo --password1 secret1 \
--host2 imap.trac.org --user2 bar --password2 secret2 \
--delete2 --delete2folders
```
Windows:
```
imapsync ^
--host1 imap.truc.org --user1 foo --password1 secret1 ^
--host2 imap.trac.org --user2 bar --password2 secret2 ^
--delete2 --delete2folders
```
Have in mind
- Backupping without restoring at least one time to check the process
is like pissing in a violin or throwing away your messages.
- Manual backups are useless, this way you will never have the ones you need to restore.
- Automatic backups are the way to go. They never forget to start. They may fail.
- Automatic backups can fail. How? Hard disks get fully filled, they crash. Networks fail too.
- Monitor the backups.
- Remenber you have backups.
- Document the restoring process or consider the backup is a just a lost trash.
- Think twice at least before running any restoring command.
== Restore ==
Restoring is not the exact reverse of backupping
since between a backup and a mistake, the context has changed,
some things went wrong but not all, for examples new messages arrived.
So synchronize an active account identical from a backup might not be the best idea.
The context can be a crash or equivalent like some if a
bad admin or service closed definitevely access to your messages.
Even in that case an exact restore, with --delete2 --delete2folders, should not be ok,
just because new messages arrive in INBOX all the time.
Plus, if the mailbox is a brand new one then --delete2 --delete2folders options are useless,
since there is nothing to delete.
== Presync ==
Presync is like a backup except deleting folders on host2 that
are not on host1 is not always wanted. Presync means a new
different imap server will host messages and folders.
Often this new imap server has predefined folders that
should be kept for proper use, so I suggest to not use
option --delete2folders.
Unix:
```
imapsync \
--host1 imap.truc.org --user1 foo --password1 secret1 \
--host2 imap.trac.org --user2 bar --password2 secret2 \
--delete2
```
Windows:
```
imapsync ^
--host1 imap.truc.org --user1 foo --password1 secret1 ^
--host2 imap.trac.org --user2 bar --password2 secret2 ^
--delete2
```

View File

@ -1,5 +1,5 @@
# $Id: Makefile,v 1.125 2013/08/03 17:25:50 gilles Exp gilles $
# $Id: Makefile,v 1.129 2013/08/16 01:21:14 gilles Exp gilles $
.PHONY: help usage all
@ -56,8 +56,15 @@ VERSION: imapsync
perl -I./$(IMAPClient) ./imapsync --version > ./VERSION
touch -r ./imapsync ./VERSION
GOOD_PRACTICES.html: GOOD_PRACTICES.t2t
txt2tags -i GOOD_PRACTICES.t2t -t html --toc -o GOOD_PRACTICES.html
.PHONY: clean clean_tilde clean_test
TUTORIAL.html: TUTORIAL.t2t
txt2tags -i TUTORIAL.t2t -t html --toc -o TUTORIAL.html
doc: README ChangeLog TUTORIAL.html GOOD_PRACTICES.html
.PHONY: clean clean_tilde clean_test doc
clean: clean_tilde clean_man
@ -259,7 +266,7 @@ DIST_PATH := ./dist/$(DIST_SECRET)
lalala:
echo $(DIST_SECRET)
dist: cidone test clean all INSTALL dist_prepa dist_prepa_exe
dist: cidone test clean all perlcritic dist_prepa dist_prepa_exe
dist_prepa: tarball dist_dir
@ -299,16 +306,16 @@ upload_ks: ci tarball
root@ks.lamiral.info:/var/www/imapsync/
rsync -lptvHzP $(PUBLIC_FILES_W) \
root@ks.lamiral.info:/var/www/imapsync/W/
rsync -lptvHzP $(PUBLIC_FILES_IMAGES) \
rsync -lptvHzPr $(PUBLIC_FILES_IMAGES) \
root@ks.lamiral.info:/var/www/imapsync/W/images/
rsync -lptvHzP ./W/ks.htaccess \
root@ks.lamiral.info:/var/www/imapsync/.htaccess
rsync -lptvHzrP ./dist/ \
rsync -lptvHzPr ./dist/ \
root@ks.lamiral.info:/var/www/imapsync/dist/
rsync -lptvHzrP ./examples/ \
rsync -lptvHzPr ./examples/ \
root@ks.lamiral.info:/var/www/imapsync/examples/
publish: upload_ks ksa
publish: dist upload_ks ksa
echo Now ou can do make ml
PUBLIC_FILES = ./ChangeLog ./NOLIMIT ./LICENSE ./CREDITS ./FAQ \
@ -321,7 +328,7 @@ PUBLIC_FILES_W = ./W/style.css \
./W/paypal.shtml ./W/paypal_return.shtml ./W/paypal_return_support.shtml
PUBLIC_FILES_IMAGES = ./W/images/logo_imapsync.png ./W/images/logo_imapsync_s.png
PUBLIC_FILES_IMAGES = ./W/images/
ml: dist_dir
m4 -P W/ml_announce.in | mutt -H-

10
README
View File

@ -4,7 +4,7 @@ NAME
More than 52 different IMAP server softwares supported with success, few
failures.
$Revision: 1.555 $
$Revision: 1.564 $
SYNOPSIS
To synchronize imap account "foo" on "imap.truc.org" to imap account
@ -92,7 +92,7 @@ USAGE
[--nofoldersizes] [--nofoldersizesatend]
[--dry]
[--debug] [--debugimap][--debugimap1][--debugimap2]
[--timeout <int>] [--fast]
[--timeout <int>]
[--split1] [--split2]
[--reconnectretry1 <int>] [--reconnectretry2 <int>]
[--noreleasecheck]
@ -317,7 +317,7 @@ IMAP SERVERS
- Hotmail since hotmail.com does not provide IMAP access
- Outlook.com since outlook.com does not provide IMAP access
Success stories reported with the following 53 imap servers (software
Success stories reported with the following 55 imap servers (software
names are in alphabetic order):
- 1und1 H mimap1 84498 [host1] H mibap4 95231 [host1]
@ -325,6 +325,7 @@ IMAP SERVERS
- Apple Server 10.6 Snow Leopard [host1]
- Archiveopteryx 2.03, 2.04, 2.09, 2.10 [host2], 3.0.0 [host2]
(OSL 3.0) http://www.archiveopteryx.org/
- Atmail 6.x [host1]
- Axigen Mail Server Version 8.0.0
- BincImap 1.2.3 (GPL) (http://www.bincimap.org/)
- CommuniGatePro server (Redhat 8.0) (Solaris), CommuniGate Pro 5.2.17[host2] (CentOS 5.4)
@ -373,6 +374,7 @@ IMAP SERVERS
- OpenWave
- Oracle Beehive [host1]
- Qualcomm Worldmail (NT)
- QQMail IMAP4Server [host1] [host2] https://en.mail.qq.com/
- Rockliffe Mailsite 5.3.11, 4.5.6
- Samsung Contact IMAP server 8.5.0
- Scalix v10.1, 10.0.1.3, 11.0.0.431, 11.4.6
@ -464,5 +466,5 @@ SIMILAR SOFTWARES
Feedback (good or bad) will often be welcome.
$Id: imapsync,v 1.555 2013/07/23 11:41:10 gilles Exp gilles $
$Id: imapsync,v 1.564 2013/08/18 19:28:47 gilles Exp gilles $

19
TODO
View File

@ -1,5 +1,5 @@
#!/bin/cat
# $Id: TODO,v 1.122 2013/08/03 02:08:33 gilles Exp gilles $
# $Id: TODO,v 1.123 2013/08/16 00:49:52 gilles Exp gilles $
TODO file for imapsync
----------------------
@ -17,8 +17,14 @@ http://www.yippiemove.com/
http://www.migrationwiz.com/
http://www.microsoft.com/download/en/details.aspx?id=1329 "Microsoft Transporter Suite"
Print the timeout value.
Inform --timeout is is seconds.
Convert folder names to utf-8 and print them next to the uft-7 ones.
Look at imapsync/W/learn/
./imap_utf7 data_utf7
DONE. Inform about --addheader when the problem occurs "(no wanted headers so we ignore this message)"
DONE. Print the timeout value.
DONE. Inform --timeout is is seconds.
Add an exit value when exiting because of --exitwhenover
The goal is to know easily why to restart later.
@ -50,6 +56,13 @@ Look at leveldb (Simon Th actux advice)
Look at http://fallabs.com/kyotocabinet/ (JYB advice)
Also Redis (Ludovic Danigo advice)
I am writing now to suggest that imapsync provide info containing the parameters
with which a message is determined to be a duplicate, so that if I wanted to confirm
they are in fact duplicates by looking at the messages themselves, enough info would
be available to easily locate them. One or two duplicates per folder are easy to
find, but I had one large folder with quite a few, and in this case it would have
been a big help.
Find a way to avoid passwords in --debugimap unless needed.

129
TUTORIAL.html Normal file
View File

@ -0,0 +1,129 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
</HEAD><BODY BGCOLOR="white" TEXT="black">
<FONT SIZE="4">
</FONT></CENTER>
<P></P>
<HR NOSHADE SIZE=1>
<P></P>
<UL>
<LI><A HREF="#toc1">Tutorial for imapsync</A>
<UL>
<LI><A HREF="#toc2">Introduction</A>
<LI><A HREF="#toc3">Conventions</A>
</UL>
</UL>
<P></P>
<HR NOSHADE SIZE=1>
<P></P>
<A NAME="toc1"></A>
<H1>Tutorial for imapsync</H1>
<A NAME="toc2"></A>
<H2>Introduction</H2>
<P>
Three Internet protocols share the big pie
access of almost all email accounts : POP, IMAP, HTTP.
</P>
<P>
The oldest one is POP, Post Office Protocol, it allows only
one main box, also called INBOX.
The second protocol is IMAP, Internet Message Access Protocol, which allows
a hierarchy of mailboxes also called folders, allows also concurrent accesses,
tagging with flags, search by many criterium like date, subject, size etc.
The third protocol is HTTP, HyperText Transfer Protocol, via webmails.
Webmails often offer the same features than imap servers and,
since webmails background is often an imap server,
a parallel access via IMAP.
</P>
<P>
Software imapsync is a command line tool to
copy, migrate, backup or synchronize IMAP mailboxes.
</P>
<P>
Command line means imapsync is not graphical, it is textual,
you have to type characters on your keyboard.
Your fingers will not suffer anyway because
I wrote examples nearly ready to go.
Most of the time you only have to change values
and adapt them to your context.
</P>
<P>
Do not be afraid, the mouse will not be forsaken.
You can still use the mouse to launch an editor,
select/copy/paste complete examples
and run the little script you edit with a doubleclick.
</P>
<P>
Imapsync runs on Unix or Windows.
It is because imapsync is written in the Perl language
and thanks to the Perl creators Perl runs everywhere.
Outside imapsync life is different;
Historically Windows came after Unix and the marvelous designers
of this old time decided it would be very cool
to not share the same syntax for doing the same things.
Thanks guys, great thinking!
</P>
<P>
To avoid you to learn by headaches a system you do not master
I will give all examples in both worlds, Unix and Windows.
Macintosh users are in the Unix world now but do not tell them,
it can hurt the olders.
</P>
<A NAME="toc3"></A>
<H2>Conventions</H2>
<P>
Imapsync has many options but you can ignore most of them
and still make great transfers.
</P>
<P>
In this documentation I write all the examples as a complete example.
In order to simplify the reading or the printing,
the command is written on several lines.
It could be written on one single line;
if you prefer the whole command on one line then
just remove the last character of each line,
it is the "\" character on Unix examples
or the "^" character on Windows examples.
</P>
<P>
For example, on Unix
</P>
<PRE>
imapsync \
--host1 imap.truc.org \
--user1 foo \
--password1 secret1 \
...
</PRE>
<P>
is equivalent to
</P>
<PRE>
imapsync --host1 imap.truc.org --user1 foo --password1 secret1 ...
</PRE>
<P></P>
<P>
and on Windows
</P>
<PRE>
imapsync ^
--host1 imap.truc.org ^
--user1 foo ^
--password1 secret1 ^
...
</PRE>
<P>
is equivalent to
</P>
<PRE>
imapsync --host1 imap.truc.org --user1 foo --password1 secret1 ...
</PRE>
<P></P>
<!-- html code generated by txt2tags 2.5 (http://txt2tags.sf.net) -->
<!-- cmdline: txt2tags -i TUTORIAL.t2t -t html -\-toc -o TUTORIAL.html -->
</BODY></HTML>

97
TUTORIAL.t2t Normal file
View File

@ -0,0 +1,97 @@
% $Id: TUTORIAL.t2t,v 1.2 2013/08/16 00:48:57 gilles Exp gilles $
= Tutorial for imapsync =
== Introduction ==
Three Internet protocols share the big pie
access of almost all email accounts : POP, IMAP, HTTP.
The oldest one is POP, Post Office Protocol, it allows only
one main box, also called INBOX.
The second protocol is IMAP, Internet Message Access Protocol, which allows
a hierarchy of mailboxes also called folders, allows also concurrent accesses,
tagging with flags, search by many criterium like date, subject, size etc.
The third protocol is HTTP, HyperText Transfer Protocol, via webmails.
Webmails often offer the same features than imap servers and,
since webmails background is often an imap server,
a parallel access via IMAP.
Software imapsync is a command line tool to
copy, migrate, backup or synchronize IMAP mailboxes.
Command line means imapsync is not graphical, it is textual,
you have to type characters on your keyboard.
Your fingers will not suffer anyway because
I wrote examples nearly ready to go.
Most of the time you only have to change values
and adapt them to your context.
Do not be afraid, the mouse will not be forsaken.
You can still use the mouse to launch an editor,
select/copy/paste complete examples
and run the little script you edit with a doubleclick.
Imapsync runs on Unix or Windows.
It is because imapsync is written in the Perl language
and thanks to the Perl creators Perl runs everywhere.
Outside imapsync life is different;
Historically Windows came after Unix and the marvelous designers
of this old time decided it would be very cool
to not share the same syntax for doing the same things.
Thanks guys, great thinking!
To avoid you to learn by headaches a system you do not master
I will give all examples in both worlds, Unix and Windows.
Macintosh users are in the Unix world now but do not tell them,
it can hurt the olders.
== Conventions ==
Imapsync has many options but you can ignore most of them
and still make great transfers.
In this documentation I write all the examples as a complete example.
In order to simplify the reading or the printing,
the command is written on several lines.
It could be written on one single line;
if you prefer the whole command on one line then
just remove the last character of each line,
it is the "\" character on Unix examples
or the "^" character on Windows examples.
For example, on Unix
```
imapsync \
--host1 imap.truc.org \
--user1 foo \
--password1 secret1 \
...
```
is equivalent to
```
imapsync --host1 imap.truc.org --user1 foo --password1 secret1 ...
```
and on Windows
```
imapsync ^
--host1 imap.truc.org ^
--user1 foo ^
--password1 secret1 ^
...
```
is equivalent to
```
imapsync --host1 imap.truc.org --user1 foo --password1 secret1 ...
```

View File

@ -1 +1 @@
1.555
1.564

View File

@ -1 +1 @@
1.558
1.564

View File

@ -224,3 +224,7 @@
1375497013 END 1.558 : samedi 3 août 2013, 04:30:13 (UTC+0200)
1375534760 BEGIN 1.558 : samedi 3 août 2013, 14:59:20 (UTC+0200)
1375536286 END 1.558 : samedi 3 août 2013, 15:24:46 (UTC+0200)
1376617407 BEGIN 1.563 : vendredi 16 août 2013, 03:43:27 (UTC+0200)
1376618294 END 1.563 : vendredi 16 août 2013, 03:58:14 (UTC+0200)
1376856084 BEGIN 1.564 : dimanche 18 août 2013, 22:01:24 (UTC+0200)
1376856924 END 1.564 : dimanche 18 août 2013, 22:15:24 (UTC+0200)

View File

@ -1,4 +1,5 @@
# $Id: $
# How to remove a message by hand.
telnet imap.truc.com 143
@ -10,3 +11,21 @@ a64 STORE 1:1 +FLAGS (\DELETED)
a75 EXPUNGE
a86 LOGOUT
# When no SEARCH ALL available
1 LOGIN test@coook.cn 1234@com
3 SELECT INBOX
4 UID SEARCH 1:11638
5 UID FETCH 11620:11637 (RFC822.SIZE)
6 UID FETCH 11000:11637 (RFC822.SIZE)
7 UID FETCH 2:11637 (RFC822.SIZE)
8 UID FETCH 1:11637 (RFC822.SIZE)
9 UID FETCH 1:11638 (RFC822.SIZE)
10 UID FETCH 1:11639 (RFC822.SIZE)
10 UID FETCH 11000:11640 (RFC822.SIZE) BAD
10 UID FETCH 1:11639 (RFC822.SIZE) OK
11 STATUS INBOX MESSAGES
11 STATUS INBOX (MESSAGES)
11 STATUS INBOX (MESSAGES UIDNEXT)

View File

@ -1,6 +1,6 @@
#!/bin/sh
# $Id: paypal_build_invoices,v 1.54 2013/07/28 04:19:32 gilles Exp gilles $
# $Id: paypal_build_invoices,v 1.55 2013/08/17 23:43:38 gilles Exp gilles $
# usage: sh paypal_build_invoices /g/var/paypal_invoices/????
@ -39,7 +39,8 @@ cp /home/gilles/public_html/AGIL/factures/000/facture_imapsync-000.tex /g/var/pa
#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 2519 /g/paypal/paypal_2013_04_complet.csv
#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 2572 /g/paypal/paypal_2013_05_complet.csv
#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 2627 /g/paypal/paypal_2013_06_complet.csv
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 2682 /g/paypal/paypal_2013_07_complet.csv
#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 2682 /g/paypal/paypal_2013_07_complet.csv
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 2741 /g/paypal/paypal_2013_08_complet.csv
: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 147 /g/paypal/paypal_2010_11_complet.csv
: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 214 /g/paypal/paypal_2010_12_complet.csv
@ -73,9 +74,10 @@ cp /home/gilles/public_html/AGIL/factures/000/facture_imapsync-000.tex /g/var/pa
: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 2519 /g/paypal/paypal_2013_04_complet.csv
: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 2572 /g/paypal/paypal_2013_05_complet.csv
: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 2627 /g/paypal/paypal_2013_06_complet.csv
: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 2682 /g/paypal/paypal_2013_07_complet.csv
set -x
: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 2682 /g/paypal/paypal_2013_07_complet.csv
: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 2741 /g/paypal/paypal_2013_08_complet.csv
set +x
# La totale

192
imapsync
View File

@ -22,7 +22,7 @@ Synchronises mailboxes between two imap servers.
Good at IMAP migration. More than 52 different IMAP server softwares
supported with success, few failures.
$Revision: 1.558 $
$Revision: 1.564 $
=head1 SYNOPSIS
@ -114,7 +114,7 @@ The option list:
[--nofoldersizes] [--nofoldersizesatend]
[--dry]
[--debug] [--debugimap][--debugimap1][--debugimap2]
[--timeout <int>] [--fast]
[--timeout <int>]
[--split1] [--split2]
[--reconnectretry1 <int>] [--reconnectretry2 <int>]
[--noreleasecheck]
@ -367,7 +367,7 @@ Failure stories reported with the following 3 imap servers:
- Hotmail since hotmail.com does not provide IMAP access
- Outlook.com since outlook.com does not provide IMAP access
Success stories reported with the following 53 imap servers
Success stories reported with the following 55 imap servers
(software names are in alphabetic order):
- 1und1 H mimap1 84498 [host1] H mibap4 95231 [host1]
@ -375,6 +375,7 @@ Success stories reported with the following 53 imap servers
- Apple Server 10.6 Snow Leopard [host1]
- Archiveopteryx 2.03, 2.04, 2.09, 2.10 [host2], 3.0.0 [host2]
(OSL 3.0) http://www.archiveopteryx.org/
- Atmail 6.x [host1]
- Axigen Mail Server Version 8.0.0
- BincImap 1.2.3 (GPL) (http://www.bincimap.org/)
- CommuniGatePro server (Redhat 8.0) (Solaris), CommuniGate Pro 5.2.17[host2] (CentOS 5.4)
@ -423,6 +424,7 @@ Success stories reported with the following 53 imap servers
- OpenWave
- Oracle Beehive [host1]
- Qualcomm Worldmail (NT)
- QQMail IMAP4Server [host1] [host2] https://en.mail.qq.com/
- Rockliffe Mailsite 5.3.11, 4.5.6
- Samsung Contact IMAP server 8.5.0
- Scalix v10.1, 10.0.1.3, 11.0.0.431, 11.4.6
@ -534,7 +536,7 @@ Entries for imapsync:
Feedback (good or bad) will often be welcome.
$Id: imapsync,v 1.558 2013/08/03 01:13:37 gilles Exp gilles $
$Id: imapsync,v 1.564 2013/08/18 19:28:47 gilles Exp gilles $
=cut
@ -655,13 +657,14 @@ my(
$messageidnodomain,
$fixInboxINBOX,
$maxlinelength,
$uidnext_default,
);
# main program
# global variables initialisation
$rcs = '$Id: imapsync,v 1.558 2013/08/03 01:13:37 gilles Exp gilles $ ';
$rcs = '$Id: imapsync,v 1.564 2013/08/18 19:28:47 gilles Exp gilles $ ';
$total_bytes_transferred = 0;
$total_bytes_skipped = 0;
@ -844,7 +847,7 @@ if ( $uidexpunge2 and not Mail::IMAPClient->can( 'uidexpunge' ) ) {
exit_clean( 3 ) ;
}
if ( $delete2 and not defined( $uidexpunge2 ) ) {
if ( ( $delete2 or $delete2duplicates ) and not defined( $uidexpunge2 ) ) {
if ( Mail::IMAPClient->can( 'uidexpunge' ) ) {
print "Info: will act as --uidexpunge2\n" ;
$uidexpunge2 = 1 ;
@ -872,6 +875,8 @@ if ($syncinternaldates) {
print "Info: turned OFF syncinternaldates\n";
}
if (defined($authmd5) and ($authmd5)) {
$authmd51 = 1 ;
$authmd52 = 1 ;
@ -908,6 +913,10 @@ $authuser2 ||= $user2;
print "Info: will try to use $authmech1 authentication on host1\n";
print "Info: will try to use $authmech2 authentication on host2\n";
$timeout = defined( $timeout ) ? $timeout : 120 ;
print "Info: imap connexions timeout is $timeout seconds\n";
$syncacls = (defined($syncacls)) ? $syncacls : 0 ;
$foldersizes = (defined($foldersizes)) ? $foldersizes : 1 ;
$foldersizesatend = (defined($foldersizesatend)) ? $foldersizesatend : $foldersizes ;
@ -920,6 +929,10 @@ $fastio2 = (defined($fastio2)) ? $fastio2 : 0;
$reconnectretry1 = (defined($reconnectretry1)) ? $reconnectretry1 : 3;
$reconnectretry2 = (defined($reconnectretry2)) ? $reconnectretry2 : 3;
# Since select_msgs() returns no messages when uidnext does not return something
# then $uidnext_default is never used. So I have to remove it.
$uidnext_default = 999999 ;
@useheader = ( "Message-Id", "Message-ID", "Received" ) unless ( @useheader ) ;
my %useheader ;
@ -1221,7 +1234,7 @@ FOLDER: foreach my $h1_fold ( @h1_folders_wanted ) {
last FOLDER if $imap2->IsUnconnected();
my $h1_msgs_all_hash_ref = { } ;
my @h1_msgs = select_msgs( $imap1, $h1_msgs_all_hash_ref, $search1 );
my @h1_msgs = select_msgs( $imap1, $h1_msgs_all_hash_ref, $search1, $h1_fold );
last FOLDER if $imap1->IsUnconnected();
my $h1_msgs_nb = scalar( @h1_msgs ) ;
@ -1231,7 +1244,7 @@ FOLDER: foreach my $h1_fold ( @h1_folders_wanted ) {
$debug and print "Host1 selecting messages of folder [$h1_fold] took ", timenext(), " s\n";
my $h2_msgs_all_hash_ref = { } ;
my @h2_msgs = select_msgs( $imap2, $h2_msgs_all_hash_ref, $search2 ) ;
my @h2_msgs = select_msgs( $imap2, $h2_msgs_all_hash_ref, $search2, $h2_fold ) ;
last FOLDER if $imap2->IsUnconnected();
my $h2_msgs_nb = scalar( @h2_msgs ) ;
@ -1306,7 +1319,8 @@ FOLDER: foreach my $h1_fold ( @h1_folders_wanted ) {
$h1_fir_ref = $imap1->fetch_hash( \@h1_msgs, "FLAGS", "INTERNALDATE", "RFC822.SIZE", $h1_fir_ref )
if ( @h1_msgs ) ;
}else{
$h1_fir_ref = $imap1->fetch_hash( '1:999999', "FLAGS", "INTERNALDATE", "RFC822.SIZE", $h1_fir_ref )
my $uidnext = $imap1->uidnext( $h1_fold ) || $uidnext_default ;
$h1_fir_ref = $imap1->fetch_hash( "1:$uidnext", "FLAGS", "INTERNALDATE", "RFC822.SIZE", $h1_fir_ref )
if ( @h1_msgs ) ;
}
$debug and print "Host1 getting flags idate and sizes of folder [$h1_fold] took ", timenext(), " s\n";
@ -1323,7 +1337,7 @@ FOLDER: foreach my $h1_fold ( @h1_folders_wanted ) {
my $rc = parse_header_msg($imap1, $m, $h1_heads_ref, $h1_fir_ref, 'Host1', \%h1_hash);
if (! defined($rc)) {
my $h1_size = $h1_fir_ref->{$m}->{"RFC822.SIZE"} || 0;
print "Host1 $h1_fold/$m size $h1_size ignored (no wanted headers so we ignore this message)\n" ;
print "Host1 $h1_fold/$m size $h1_size ignored (no wanted headers so we ignore this message. To solve this: use --addheader)\n" ;
$total_bytes_skipped += $h1_size;
$nb_msg_skipped += 1;
$h1_nb_msg_noheader +=1;
@ -1353,8 +1367,17 @@ FOLDER: foreach my $h1_fold ( @h1_folders_wanted ) {
$debug and print "Host2 getting flags idate and sizes of folder [$h2_fold]\n" ;
@$h2_fir_ref{@h2_msgs} = ( ); # fetch_hash can select by uid with last arg as ref
$h2_fir_ref = $imap2->fetch_hash( \@h2_msgs, "FLAGS", "INTERNALDATE", "RFC822.SIZE", $h2_fir_ref)
if (@h2_msgs);
if ( $abletosearch ) {
$h2_fir_ref = $imap2->fetch_hash( \@h2_msgs, "FLAGS", "INTERNALDATE", "RFC822.SIZE", $h2_fir_ref)
if (@h2_msgs) ;
}else{
my $uidnext = $imap2->uidnext( $h2_fold ) || $uidnext_default ;
$h2_fir_ref = $imap2->fetch_hash( "1:$uidnext", "FLAGS", "INTERNALDATE", "RFC822.SIZE", $h2_fir_ref )
if ( @h2_msgs ) ;
}
$debug and print "Host2 getting flags idate and sizes of folder [$h2_fold] took ", timenext(), " s\n" ;
my @h2_msgs_duplicate;
@ -1687,6 +1710,8 @@ sub sync_flags {
$h1_flags = flags_for_host2( $h1_flags, $permanentflags2 ) ;
$h2_flags = flagsCase( $h2_flags ) ;
( $debug or $debugflags ) and
print "Host1 flags filt msg $h1_fold/$h1_msg flags( $h1_flags ) Host2 $h2_fold/$h2_msg flags( $h2_flags )\n" ;
@ -2238,8 +2263,8 @@ sub banner_imapsync {
my @argv = @_ ;
my $banner_imapsync = join("",
'$RCSfile: imapsync,v $ ',
'$Revision: 1.558 $ ',
'$Date: 2013/08/03 01:13:37 $ ',
'$Revision: 1.564 $ ',
'$Date: 2013/08/18 19:28:47 $ ',
"\n",localhost_info(), "\n",
"Command line used:\n",
"$0 ", command_line_nopassword( @argv ), "\n",
@ -2794,7 +2819,7 @@ sub foldersizes {
}
my $hash_ref = { } ;
my @msgs = select_msgs( $imap, undef, $search_cmd ) ;
my @msgs = select_msgs( $imap, undef, $search_cmd, $folder ) ;
$nb_msgs = scalar( @msgs ) ;
my $biggest_in_folder = 0 ;
@$hash_ref{ @msgs } = ( undef ) if @msgs ;
@ -2802,7 +2827,8 @@ sub foldersizes {
if ( $abletosearch ) {
$imap->fetch_hash( \@msgs, "RFC822.SIZE", $hash_ref) or die_clean("$@" ) ;
}else{
$imap->fetch_hash( '1:999999', "RFC822.SIZE", $hash_ref ) or die_clean( "$@" ) ;
my $uidnext = $imap->uidnext( $folder ) || $uidnext_default ;
$imap->fetch_hash( "1:$uidnext", "RFC822.SIZE", $hash_ref ) or die_clean( "$@" ) ;
}
for ( keys %$hash_ref ) {
my $size = $hash_ref->{ $_ }->{ "RFC822.SIZE" } ;
@ -3095,26 +3121,35 @@ sub tests_ucsecond {
return( ) ;
}
sub select_msgs {
my ( $imap, $msgs_all_hash_ref, $search_cmd ) = @_ ;
my ( $imap, $msgs_all_hash_ref, $search_cmd, $folder ) = @_ ;
my ( @msgs ) ;
if ( $abletosearch ) {
@msgs = select_msgs_by_search( $imap, $msgs_all_hash_ref, $search_cmd, $folder ) ;
}else{
@msgs = select_msgs_by_fetch( $imap, $msgs_all_hash_ref, $search_cmd, $folder ) ;
}
}
sub select_msgs_by_search {
my ( $imap, $msgs_all_hash_ref, $search_cmd, $folder ) = @_ ;
my ( @msgs, @msgs_all ) ;
# Need to have the whole list in msgs_all_hash_ref
# without calling messages() several times.
# Need all messages list to avoid deleting useful cache part
# in case of --search or --minage or --maxage
if ( ( defined( $msgs_all_hash_ref ) and $usecache )
or ( not defined( $maxage ) and not defined( $minage ) and not defined( $search_cmd ) )
) {
if ( $abletosearch ) {
$debugdev and print "Calling messages()\n" ;
@msgs_all = $imap->messages() ;
}else{
$debugdev and print "Calling fetch_hash()\n" ;
@msgs_all = sort { $a <=> $b } keys( %{$imap->fetch_hash( '1:999999', "RFC822.SIZE")} ) ;
$debugdev and print "Done fetch_hash()\n" ;
}
$debugdev and print "Calling messages()\n" ;
@msgs_all = $imap->messages() ;
return if ( $#msgs_all == 0 && !defined( $msgs_all[0] ) ) ;
if ( defined( $msgs_all_hash_ref ) ) {
@ -3136,6 +3171,57 @@ sub select_msgs {
return( @msgs );
}
sub select_msgs_by_fetch {
my ( $imap, $msgs_all_hash_ref, $search_cmd, $folder ) = @_ ;
my ( @msgs, @msgs_all, %fetch ) ;
# Need to have the whole list in msgs_all_hash_ref
# without calling messages() several times.
# Need all messages list to avoid deleting useful cache part
# in case of --search or --minage or --maxage
$debugdev and print "Calling fetch_hash()\n" ;
my $uidnext = $imap->uidnext( $folder ) or return( ) ;
%fetch = %{$imap->fetch_hash( "1:$uidnext", "INTERNALDATE") } ;
@msgs_all = sort { $a <=> $b } keys( %fetch ) ;
$debugdev and print "Done fetch_hash()\n" ;
return( ) if ( $#msgs_all == 0 && !defined( $msgs_all[0] ) ) ;
if ( defined( $msgs_all_hash_ref ) ) {
@{ $msgs_all_hash_ref }{ @msgs_all } = () ;
}
# return all messages
if ( not defined( $maxage ) and not defined( $minage ) and not defined( $search_cmd ) ) {
return( @msgs_all ) ;
}
if ( defined( $search_cmd ) ) {
print "Warning: strange to see --search with --noabletosearch, an error can happen\n" ;
@msgs = $imap->search( $search_cmd ) ;
return( @msgs ) ;
}
# we are here only if $maxage or $minage is defined
my( @max, @min, $maxage_epoch, $minage_epoch ) ;
if ( defined( $maxage ) ) { $maxage_epoch = $timestart_int - 86400 * $maxage ; }
if ( defined( $minage ) ) { $minage_epoch = $timestart_int - 86400 * $minage ; }
foreach my $msg ( @msgs_all ) {
my $idate = $fetch{ $msg }->{'INTERNALDATE'} ;
#print "$idate\n" ;
if ( defined( $maxage ) and ( epoch( $idate ) >= $maxage_epoch ) ) {
push( @max, $msg ) ;
}
if ( defined( $minage ) and ( epoch( $idate ) <= $minage_epoch ) ) {
push( @min, $msg ) ;
}
}
@msgs = msgs_from_maxmin( \@max, \@min ) ;
return( @msgs ) ;
}
sub select_msgs_by_age {
my( $imap ) = @_ ;
@ -3144,26 +3230,53 @@ sub select_msgs_by_age {
if ( defined( $maxage ) ) {
@max = $imap->sentsince( $timestart_int - 86400 * $maxage ) ;
}
if ( defined($minage ) ) {
if ( defined( $minage ) ) {
@min = $imap->sentbefore( $timestart_int - 86400 * $minage ) ;
}
@msgs = msgs_from_maxmin( \@max, \@min ) ;
return( @msgs ) ;
}
sub msgs_from_maxmin {
my( $max_ref, $min_ref ) = @_ ;
my( @max, @min, @msgs, @inter, @union ) ;
@max = @$max_ref ;
@min = @$min_ref ;
SWITCH: {
unless( defined( $minage ) ) { @msgs = @max ; last SWITCH } ;
unless( defined( $maxage ) ) { @msgs = @min ; last SWITCH } ;
my ( %union, %inter ) ;
foreach my $m ( @min, @max ) { $union{ $m }++ && $inter{ $m }++ }
@inter = keys( %inter ) ;
@union = keys( %union ) ;
@inter = sort { $a <=> $b } keys( %inter ) ;
@union = sort { $a <=> $b } keys( %union ) ;
# normal case
if ( $minage <= $maxage ) { @msgs = @inter ; last SWITCH } ;
# just exclude messages between
if ( $minage > $maxage ) { @msgs = @union ; last SWITCH } ;
}
return( @msgs );
}
sub tests_msgs_from_maxmin {
my @msgs ;
$maxage = 200 ;
@msgs = msgs_from_maxmin( [ '1', '2' ], [ '2', '3' ] ) ;
ok( 0 == compare_lists( [ '1', '2' ], \@msgs ), 'msgs_from_maxmin: maxage++' ) ;
$minage = 100 ;
@msgs = msgs_from_maxmin( [ '1', '2' ], [ '2', '3' ] ) ;
ok( 0 == compare_lists( [ '2' ], \@msgs ), 'msgs_from_maxmin: -maxage++minage-' ) ;
$minage = 300 ;
@msgs = msgs_from_maxmin( [ '1', '2' ], [ '2', '3' ] ) ;
ok( 0 == compare_lists( [ '1', '2', '3' ], \@msgs ), 'msgs_from_maxmin: ++maxage-minage++' ) ;
$maxage = undef ;
@msgs = msgs_from_maxmin( [ '1', '2' ], [ '2', '3' ] ) ;
ok( 0 == compare_lists( [ '2', '3' ], \@msgs ), 'msgs_from_maxmin: ++minage-' ) ;
}
sub lastuid {
my $imap = shift ;
@ -4544,7 +4657,7 @@ sub check_last_release {
}
sub imapsync_version {
my $rcs_imapsync = '$Id: imapsync,v 1.558 2013/08/03 01:13:37 gilles Exp gilles $ ' ;
my $rcs_imapsync = '$Id: imapsync,v 1.564 2013/08/18 19:28:47 gilles Exp gilles $ ' ;
my $imapsync_version ;
if ( $rcs_imapsync =~ m{,v\s+(\d+\.\d+)}xo ) {
@ -4980,7 +5093,7 @@ sub list_folders_in_2_not_in_1 {
map { $h2_folders_not_in_h1{$_} = 1} @h2_folders_not_in_h1 ;
@h2_folders_not_in_h1 = list_keys_in_2_not_in_1( \%h2_folders_from_1_all, \%h2_folders_not_in_h1) ;
return( reverse @h2_folders_not_in_1 );
return( reverse @h2_folders_not_in_h1 );
}
sub delete_folders_in_2_not_in_1 {
@ -5195,7 +5308,7 @@ sub epoch {
my ( $mday, $month, $year, $hour, $min, $sec, $sign, $zone_h, $zone_m ) ;
my $time ;
if ( $d =~ m{(\d{2})-([A-Z][a-z]{2})-(\d{4})\s(\d{2}):(\d{2}):(\d{2})\s((?:\+|-))(\d{2})(\d{2})}xo ) {
if ( $d =~ m{(\d{1,2})-([A-Z][a-z]{2})-(\d{4})\s(\d{2}):(\d{2}):(\d{2})\s((?:\+|-))(\d{2})(\d{2})}xo ) {
#print "internal: [$1][$2][$3][$4][$5][$6][$7][$8][$9]\n" ;
( $mday, $month, $year, $hour, $min, $sec, $sign, $zone_h, $zone_m )
= ( $1, $2, $3, $4, $5, $6, $7, $8, $9 ) ;
@ -5218,6 +5331,12 @@ sub tests_epoch {
ok( '1282658400' eq epoch( '24-Aug-2010 12:00:00 -0200' ), 'epoch 24-Aug-2010 12:00:00 -0200 -> 1282658400' ) ;
ok( '1282658400' eq epoch( '24-Aug-2010 16:01:00 +0201' ), 'epoch 24-Aug-2010 16:01:00 +0201 -> 1282658400' ) ;
ok( '1282658400' eq epoch( '24-Aug-2010 14:01:00 +0001' ), 'epoch 24-Aug-2010 14:01:00 +0001 -> 1282658400' ) ;
ok( '1280671200' eq epoch( '1-Aug-2010 16:00:00 +0200' ), 'epoch 1-Aug-2010 16:00:00 +0200 -> 1280671200' ) ;
ok( '1280671200' eq epoch( '1-Aug-2010 14:00:00 +0000' ), 'epoch 1-Aug-2010 14:00:00 +0000 -> 1280671200' ) ;
ok( '1280671200' eq epoch( '1-Aug-2010 12:00:00 -0200' ), 'epoch 1-Aug-2010 12:00:00 -0200 -> 1280671200' ) ;
ok( '1280671200' eq epoch( '1-Aug-2010 16:01:00 +0201' ), 'epoch 1-Aug-2010 16:01:00 +0201 -> 1280671200' ) ;
ok( '1280671200' eq epoch( '1-Aug-2010 14:01:00 +0001' ), 'epoch 1-Aug-2010 14:01:00 +0001 -> 1280671200' ) ;
return( ) ;
}
@ -5327,12 +5446,15 @@ Several options are mandatory.
--ssl2 : Use an SSL connection on host2.
--tls1 : Use an TLS connection on host1.
--tls2 : Use an TLS connection on host2.
--timeout <int> : Connections timeout in seconds. Default is 120.
0 means no timeout.
--folder <string> : Sync this folder.
--folder <string> : and this one, etc.
--folderrec <string> : Sync this folder recursively.
--folderrec <string> : and this one, etc.
--include <regex> : Sync folders matching this regular expression
Blancs like in "foo bar" have to be written "foo\\ bar"
--include <regex> : or this one, etc.
in case both --include --exclude options are
use, include is done before.
@ -5513,7 +5635,6 @@ sub usage_complete {
<int> is the number of messages handled per request.
default is like --split1 500.
--split2 <int> : same thing on host2.
--timeout <int> : imap connect timeout.
EOF
return( ) ;
}
@ -5690,7 +5811,7 @@ sub tests_debug {
SKIP: {
skip "No test in normal run" if ( not $tests_debug );
tests_subject( ) ;
tests_msgs_from_maxmin( ) ;
}
return( ) ;
}
@ -5741,6 +5862,7 @@ sub tests {
tests_fix_Inbox_INBOX_mapping( ) ;
tests_max_line_length( ) ;
tests_subject( ) ;
tests_msgs_from_maxmin( ) ;
}
return( ) ;
}

View File

@ -5,7 +5,7 @@
<title>Official imapsync migration tool ( release <!--#exec cmd="cat ./VERSION"--> )</title>
<meta name="generator" content="Bluefish 1.0.7"/>
<meta name="author" content="Gilles LAMIRAL"/>
<meta name="date" content="2013-08-03T18:23:52+0200"/>
<meta name="date" content="2013-08-04T22:34:47+0200"/>
<meta name="copyright" content="None"/>
<meta name="keywords" content="imap, transfert, migration"/>
<meta name="description" content="imap migration tool"/>
@ -117,7 +117,7 @@ total is 93 millions for 2011, 91 millions for 2012, 66 millions for half 2013</
<!--
<ul>
<li><b>1.558</b></li>
<li><b>1.564</b></li>
<li><b>Enhancement</b>: </li>
<li><b>Enhancement</b>: </li>
<li><b>Enhancement</b>: </li>
@ -127,7 +127,7 @@ total is 93 millions for 2011, 91 millions for 2012, 66 millions for half 2013</
<li><b>Usability</b>: </li>
<li><b>Usability</b>: </li>
<li><b>Bug fix</b>: </li>
<li><b>Bug fix</b>: </li>
<li><b><Bug fix</b>: </li>
<li><b>Bug fix</b>: </li>
<li><b>Bug fix</b>: </li>
<li><b>Refactoring</b>: </li>
@ -138,14 +138,30 @@ total is 93 millions for 2011, 91 millions for 2012, 66 millions for half 2013</
-->
<ul>
<li><b>1.558</b> Better Office365 and Mailenable handling</li>
<li><b>1.564</b> QQMail support</li>
<li><b>Enhancement</b>: Adapted behavior for allowing --maxdate --mindate with --noabletosearch.
Use internat date instead of Date: header.</li>
<li><b>Enhancement</b>: QQMail IMAP4Server success (with --noabletosearch option) </li>
<li><b>Usability</b>: Apply same treatment to --delete2duplicates as --delete2.
If --uidexpunge2 can be done, do it, else do --expunge2 (unless --nouidexpunge2 or --noexpunge2).</li>
<li><b>Usability</b>: Added --addheader suggestion in outpout in case messages with no header are found.</li>
<li><b>Usability</b>: Added --timeout in the --help output. Default timeout is 120 seconds now
(was nothing by imapsync, 600 with underlying modules).</li>
</ul>
<ul>
<li><b>1.558</b> SSL fix.</li>
<li><b>Enhancement/Bug fix</b>: Added --ssl1_SSL_version and --ssl2_SSL_version to force the SSL_version
in case the default auto-negociation does not work. Example: <b>--ssl1 --ssl1_SSL_version SSLv3</b></li>
</ul>
<ul>
<li><b>1.555</b> Better Office365 and Mailenable handling</li>
<li><b>Enhancement</b>: Added option --messageidnodomain to fix Mailenable bug changing the domain part of Message-Id header, and avoid duplicates</li>
<li><b>Enhancement</b>: Added option --syncflagsaftercopy to fix Mailenable bug not getting the flags with the APPEND</li>
<li><b>Enhancement</b>: Added option <b>--maxlinelength</b> to skip messages whose max line length is over a number of bytes.
Exchange 2013 and Office365 need <b>--maxlinelength 1000</b> (which is a RFC2822 must) to avoid disconnections.</li>
<li><b>Enhancement/Bug fix</b>: Added --ssl1_SSL_version and --ssl2_SSL_version to force the SSL_version
in case the default auto-negociation does not work. Example: <b>--ssl1 --ssl1_SSL_version SSLv3</b></li>
<li><b>Usability</b>: Added back the banner of IMAP servers, ie, the first line given after the connection established.</li>
<li><b>Usability</b>: Added --fixInboxINBOX, turned on by default, to map automatically Inbox INBOX folder names.</li>
<li><b>Usability</b>: IMAP server removing consecutive spaces on the header part doesn't generate duplicates (MailEnable does that)</li>
@ -621,7 +637,7 @@ I like it.
</ul>
<p>Now the long reported <b>success stories</b> list: <b>
53 different imap server softwares supported!</b><br/>
55 different imap server softwares supported!</b><br/>
[host1] means "source server" and [host2] means "destination server":
</p>
@ -635,6 +651,7 @@ I like it.
<li><b>Apple Server</b> 10.6 Snow Leopard [host1] </li>
<li>Archiveopteryx 2.03, 2.04, 2.09, 2.10 [host2], 3.0.0 [host2]
(OSL 3.0) (<a href="http://www.archiveopteryx.org/">http://www.archiveopteryx.org/</a>)</li>
<li>Atmail 6.x [host1] <a href="http://atmail.com/">http://atmail.com/</a></li>
<li>Axigen Mail Server Version 8.0.0 (<a href="http://www.axigen.com/">http://www.axigen.com/</a>)</li>
<li>BincImap 1.2.3 (GPL) (<a href="http://www.bincimap.org/">http://www.bincimap.org/</a>)</li>
<li>CommuniGatePro server (Redhat 8.0) (Solaris), CommuniGate Pro 5.2.17[host2] (CentOS 5.4)
@ -695,6 +712,7 @@ I like it.
(<a href="http://www.oracle.com/technetwork/middleware/beehive/">http://www.oracle.com/technetwork/middleware/beehive/</a>) </li>
<li>Qualcomm Worldmail (NT) (<a href="http://www.eudora.com/worldmail/">http://www.eudora.com/worldmail/</a>) </li>
<li>Rockliffe Mailsite 5.3.11, 4.5.6 (<a href="http://www.mailsite.com/">http://www.mailsite.com/</a>) </li>
<li>QQMail IMAP4Server [host1] [host2] (See FAQ) <a href="https://en.mail.qq.com/">https://en.mail.qq.com/</a> </li>
<li>Samsung Contact IMAP server 8.5.0 </li>
<li>Scalix v10.1, 10.0.1.3, 11.0.0.431, 11.4.6 (<a href="http://www.scalix.com/">http://www.scalix.com/</a>) </li>
<li>SmarterMail, Smarter Mail 5.0 Enterprise, Smarter Mail 5.5 [host1], SmarterMail Professional 10.2 [host1]. (<a href="http://www.smartertools.com/">http://www.smartertools.com/</a>) </li>
@ -757,19 +775,19 @@ Prices are given par mailbox and may be outdated (december 2011).</p>
<p>
<a href="http://validator.w3.org/check?uri=referer">
<img
src="http://www.w3.org/Icons/valid-xhtml10"
src="W/images/valid-xhtml10"
alt="Valid XHTML 1.0 Strict" height="31" width="88" />
</a>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
<img style="border:0;width:88px;height:31px"
src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
src="W/images/vcss-blue"
alt="CSS Valide !" />
</a>
<a href="http://www.anybrowser.org/campaign/">
<img style="border:0;width:88px;height:31px"
src="http://www.anybrowser.org/campaign/bvgraphics/ab_jlh.png"
src="W/images/ab_jlh.png"
alt="Viewable With Any Browser" />
</a>
</p>
@ -779,7 +797,7 @@ alt="Viewable With Any Browser" />
<!--#config timefmt="%D" -->
<!--#config timefmt="%A %B %d, %Y" -->
<b>This document last modified on <!--#echo var="LAST_MODIFIED" --></b>
($Id: index.shtml,v 1.175 2013/08/03 16:24:06 gilles Exp gilles $)
($Id: index.shtml,v 1.180 2013/08/19 21:30:37 gilles Exp gilles $)
</p>
</body>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,23 @@
Main code has high complexity score (326) at line 1, column 1. Consider refactoring. (Severity: 3)
Code structure is deeply nested at line 1489, column 41. Consider refactoring. (Severity: 3)
Too many arguments at line 1656, column 1. See page 182 of PBP. (Severity: 3)
Too many arguments at line 1671, column 1. See page 182 of PBP. (Severity: 3)
Too many arguments at line 1681, column 1. See page 182 of PBP. (Severity: 3)
Too many arguments at line 1968, column 1. See page 182 of PBP. (Severity: 3)
Too many arguments at line 2024, column 1. See page 182 of PBP. (Severity: 3)
Too many arguments at line 2099, column 1. See page 182 of PBP. (Severity: 3)
Expression form of "eval" at line 2724, column 13. See page 161 of PBP. (Severity: 5)
Expression form of "eval" at line 2941, column 13. See page 161 of PBP. (Severity: 5)
Subroutine "copy_message" with high complexity score (21) at line 3211, column 1. Consider refactoring. (Severity: 3)
Too many arguments at line 3211, column 1. See page 182 of PBP. (Severity: 3)
Too many arguments at line 3271, column 1. See page 182 of PBP. (Severity: 3)
Subroutine "tests_subject" does not end with "return" at line 3365, column 1. See page 197 of PBP. (Severity: 4)
Too many arguments at line 3428, column 1. See page 182 of PBP. (Severity: 3)
Expression form of "eval" at line 4185, column 13. See page 161 of PBP. (Severity: 5)
Too many arguments at line 4343, column 1. See page 182 of PBP. (Severity: 3)
Expression form of "eval" at line 4975, column 43. See page 161 of PBP. (Severity: 5)
Expression form of "eval" at line 4979, column 45. See page 161 of PBP. (Severity: 5)
"$i" is declared but not used at line 5237, column 9. Unused variables clutter code and make it harder to read. (Severity: 3)
Main code has high complexity score (333) at line 1, column 1. Consider refactoring. (Severity: 3)
Code structure is deeply nested at line 1513, column 41. Consider refactoring. (Severity: 3)
Too many arguments at line 1680, column 1. See page 182 of PBP. (Severity: 3)
Too many arguments at line 1695, column 1. See page 182 of PBP. (Severity: 3)
Too many arguments at line 1705, column 1. See page 182 of PBP. (Severity: 3)
Too many arguments at line 1939, column 1. See page 182 of PBP. (Severity: 3)
Too many arguments at line 1994, column 1. See page 182 of PBP. (Severity: 3)
Too many arguments at line 2050, column 1. See page 182 of PBP. (Severity: 3)
Too many arguments at line 2141, column 1. See page 182 of PBP. (Severity: 3)
Expression form of "eval" at line 2766, column 13. See page 161 of PBP. (Severity: 5)
Expression form of "eval" at line 2984, column 13. See page 161 of PBP. (Severity: 5)
Subroutine "select_msgs" does not end with "return" at line 3125, column 1. See page 197 of PBP. (Severity: 4)
Subroutine "tests_msgs_from_maxmin" does not end with "return" at line 3264, column 1. See page 197 of PBP. (Severity: 4)
Subroutine "copy_message" with high complexity score (21) at line 3341, column 1. Consider refactoring. (Severity: 3)
Too many arguments at line 3341, column 1. See page 182 of PBP. (Severity: 3)
Too many arguments at line 3401, column 1. See page 182 of PBP. (Severity: 3)
Subroutine "tests_subject" does not end with "return" at line 3495, column 1. See page 197 of PBP. (Severity: 4)
Too many arguments at line 3558, column 1. See page 182 of PBP. (Severity: 3)
Expression form of "eval" at line 4315, column 13. See page 161 of PBP. (Severity: 5)
Too many arguments at line 4470, column 1. See page 182 of PBP. (Severity: 3)
Expression form of "eval" at line 5102, column 43. See page 161 of PBP. (Severity: 5)
Expression form of "eval" at line 5106, column 45. See page 161 of PBP. (Severity: 5)
"$i" is declared but not used at line 5370, column 9. Unused variables clutter code and make it harder to read. (Severity: 3)

View File

@ -1,6 +1,6 @@
#!/bin/sh
# $Id: tests.sh,v 1.222 2013/08/03 17:26:19 gilles Exp gilles $
# $Id: tests.sh,v 1.224 2013/08/18 19:30:46 gilles Exp gilles $
# Example 1:
# CMD_PERL='perl -I./Mail-IMAPClient-3.33/lib' sh -x tests.sh
@ -557,6 +557,33 @@ ll_delete2foldersbutnot() {
--dry
}
ll_delete2foldersonly_NEW_3() {
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--justfolders --nofoldersizes \
--regextrans2 's,^INBOX.oneemail$,INBOX.NEW_3.oneemail,' \
--regextrans2 's,^INBOX.oneemail2$,INBOX.NEW_3.oneemail2,'
test -d /home/vmail/titi/.NEW_3.oneemail/ || return 1
test -d /home/vmail/titi/.NEW_3.oneemail2/ || return 1
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--justfolders --nofoldersizes \
--include 'rrrrr' \
--delete2foldersonly '/^INBOX.NEW_3.oneemail$/'
! test -d /home/vmail/titi/.NEW_3.oneemail/ || return 1
test -d /home/vmail/titi/.NEW_3.oneemail2/ || return 1
}
ll_delete2folders() {
@ -567,6 +594,8 @@ ll_delete2folders() {
--passfile2 ../../var/pass/secret.titi \
--justfolders --nofoldersizes \
--delete2folders
! test -d /home/vmail/titi/.NEW_3/ || return 1
}
@ -884,6 +913,30 @@ ll_maxage_9999_minage_10000()
--folder INBOX --justfoldersizes
}
ll_maxage_10000_minage_9999_noabletosearch()
{
# INTERSECTION: 0 messages
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--maxage 10000 --minage 9999 \
--folder INBOX --justfoldersizes --noabletosearch
}
ll_maxage_9999_minage_10000_noabletosearch()
{
# UNION: all messages
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--maxage 9999 --minage 10000 \
--folder INBOX --justfoldersizes --noabletosearch
}
ll_maxage_10000()
@ -1207,7 +1260,17 @@ ll_exclude_INBOX()
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--exclude '^INBOX$' --justfolders --nofoldersizes --dry
--exclude '^INBOX' --justfolders --nofoldersizes --dry
}
ll_exclude_blanc_middle()
{
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--exclude '^INBOX.blanc\smiddle' --justfolders --nofoldersizes --dry
}
@ -3392,6 +3455,7 @@ ll_usecache
ll_usecache_noheader
ll_usecache_debugcache
ll_nousecache
ll_delete2foldersonly_NEW_3
ll_delete2foldersonly
ll_delete2foldersonly_tmp
ll_delete2foldersbutnot