2013-09-26 23:59:52 +02:00
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
|
|
<HTML>
|
|
|
|
<HEAD>
|
2016-01-22 17:52:28 +01:00
|
|
|
<META NAME="generator" CONTENT="http://txt2tags.org">
|
2017-09-23 23:54:48 +02:00
|
|
|
<TITLE>Good practices for imapsync</TITLE>
|
2013-09-26 23:59:52 +02:00
|
|
|
</HEAD><BODY BGCOLOR="white" TEXT="black">
|
2016-01-22 17:52:28 +01:00
|
|
|
<CENTER>
|
2017-09-23 23:54:48 +02:00
|
|
|
<H1>Good practices for imapsync</H1>
|
2018-05-07 16:04:23 +02:00
|
|
|
<FONT SIZE="4"><I>Gilles LAMIRAL gilles@lamiral.info</I></FONT><BR>
|
2020-04-11 01:15:57 +02:00
|
|
|
<FONT SIZE="4">% $Id: GOOD_PRACTICES.t2t,v 1.10 2019/11/25 12:50:54 gilles Exp gilles $</FONT>
|
2016-01-22 17:52:28 +01:00
|
|
|
</CENTER>
|
2013-09-26 23:59:52 +02:00
|
|
|
|
|
|
|
<P></P>
|
|
|
|
<HR NOSHADE SIZE=1>
|
|
|
|
<P></P>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<UL>
|
2017-09-23 23:54:48 +02:00
|
|
|
<LI><A HREF="#toc1">Good practices for imapsync</A>
|
2013-09-26 23:59:52 +02:00
|
|
|
<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>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<A NAME="toc1"></A>
|
2017-09-23 23:54:48 +02:00
|
|
|
<H1>Good practices for imapsync</H1>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<P>
|
2020-04-11 01:15:57 +02:00
|
|
|
You are not supposed to have read the TUTORIAL documentation but
|
2013-09-26 23:59:52 +02:00
|
|
|
reading it should help to understand and master the following best practices.
|
|
|
|
</P>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<A NAME="toc2"></A>
|
|
|
|
<H2>Simple transfer</H2>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<P>
|
|
|
|
By principle, imapsync does not change any single byte of messages,
|
|
|
|
unless --regexmess or --addheader is used.
|
2020-04-11 01:15:57 +02:00
|
|
|
Imapsync identifies messages with "Message-Id" and "Received" headers,
|
|
|
|
so it ignores messages that lack those headers;
|
2013-09-26 23:59:52 +02:00
|
|
|
most of the time it happens with the "Sent" folders.
|
2020-04-11 01:15:57 +02:00
|
|
|
</P>
|
|
|
|
<P>
|
2013-09-26 23:59:52 +02:00
|
|
|
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.
|
|
|
|
</P>
|
|
|
|
<P>
|
|
|
|
Unix:
|
|
|
|
</P>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<PRE>
|
|
|
|
imapsync \
|
|
|
|
--host1 imap.truc.org --user1 foo --password1 secret1 \
|
|
|
|
--host2 imap.trac.org --user2 bar --password2 secret2 \
|
|
|
|
--addheader
|
|
|
|
</PRE>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<P>
|
|
|
|
Windows:
|
|
|
|
</P>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<PRE>
|
|
|
|
imapsync ^
|
|
|
|
--host1 imap.truc.org --user1 foo --password1 secret1 ^
|
|
|
|
--host2 imap.trac.org --user2 bar --password2 secret2 ^
|
|
|
|
--addheader
|
|
|
|
</PRE>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<A NAME="toc3"></A>
|
|
|
|
<H2>Exact backup</H2>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<P>
|
|
|
|
Assertions for this example:
|
|
|
|
</P>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<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:
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<PRE>
|
|
|
|
imapsync \
|
|
|
|
--host1 imap.truc.org --user1 foo --password1 secret1 \
|
|
|
|
--host2 imap.trac.org --user2 bar --password2 secret2 \
|
|
|
|
--delete2 --delete2folders
|
|
|
|
</PRE>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
Windows:
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<PRE>
|
|
|
|
imapsync ^
|
|
|
|
--host1 imap.truc.org --user1 foo --password1 secret1 ^
|
|
|
|
--host2 imap.trac.org --user2 bar --password2 secret2 ^
|
|
|
|
--delete2 --delete2folders
|
|
|
|
</PRE>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
</UL>
|
|
|
|
|
|
|
|
<P>
|
|
|
|
Have in mind
|
|
|
|
</P>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<UL>
|
2018-05-07 16:04:23 +02:00
|
|
|
<LI>Doing backups without restoring at least one time to check the process
|
2013-09-26 23:59:52 +02:00
|
|
|
is like pissing in a violin or throwing away your messages.
|
2018-05-07 16:04:23 +02:00
|
|
|
<LI>Manual backups are useless because manually you will never have the ones you need
|
|
|
|
to restore, they will always be out of date.
|
|
|
|
<LI>Automatic backups are the way to go. They never forget to start. But they may fail.
|
|
|
|
<LI>Automatic backups can fail. How? Hard disks get fully filled, they crash.
|
|
|
|
Networks fail too.
|
2013-09-26 23:59:52 +02:00
|
|
|
<LI>Monitor the backups.
|
2018-05-07 16:04:23 +02:00
|
|
|
<LI>Remember you have backups.
|
2013-09-26 23:59:52 +02:00
|
|
|
<LI>Document the restoring process or consider the backup is a just a lost trash.
|
2018-05-07 16:04:23 +02:00
|
|
|
<LI>Think twice at least before running any restoring command.
|
|
|
|
Restoring is dangerous.
|
2013-09-26 23:59:52 +02:00
|
|
|
</UL>
|
|
|
|
|
|
|
|
<A NAME="toc4"></A>
|
|
|
|
<H2>Restore</H2>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<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>
|
2016-01-22 17:52:28 +01:00
|
|
|
The context can be a crash or equivalent like when a
|
|
|
|
not friendly admin or service closed definitevely access to your messages.
|
2013-09-26 23:59:52 +02:00
|
|
|
Even in that case an exact restore, with --delete2 --delete2folders, should not be ok,
|
|
|
|
just because new messages arrive in INBOX all the time.
|
|
|
|
</P>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<A NAME="toc5"></A>
|
|
|
|
<H2>Presync</H2>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<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>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<PRE>
|
|
|
|
imapsync \
|
|
|
|
--host1 imap.truc.org --user1 foo --password1 secret1 \
|
|
|
|
--host2 imap.trac.org --user2 bar --password2 secret2 \
|
|
|
|
--delete2
|
|
|
|
</PRE>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<P>
|
|
|
|
Windows:
|
|
|
|
</P>
|
2016-01-22 17:52:28 +01:00
|
|
|
|
2013-09-26 23:59:52 +02:00
|
|
|
<PRE>
|
|
|
|
imapsync ^
|
|
|
|
--host1 imap.truc.org --user1 foo --password1 secret1 ^
|
|
|
|
--host2 imap.trac.org --user2 bar --password2 secret2 ^
|
|
|
|
--delete2
|
|
|
|
</PRE>
|
|
|
|
|
2016-01-22 17:52:28 +01:00
|
|
|
<!-- html code generated by txt2tags 2.6 (http://txt2tags.org) -->
|
|
|
|
<!-- cmdline: txt2tags -i doc/GOOD_PRACTICES.t2t -t html -\-toc -o doc/GOOD_PRACTICES.html -->
|
2013-09-26 23:59:52 +02:00
|
|
|
</BODY></HTML>
|