forked from imapsync/imapsync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GOOD_PRACTICES.t2t
129 lines (94 loc) · 4.03 KB
/
GOOD_PRACTICES.t2t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
% $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
```