1IMAPSYNC(1) User Contributed Perl Documentation IMAPSYNC(1)
2
3
4
6 imapsync - Email IMAP tool for syncing, copying, migrating and
7 archiving email mailboxes between two imap servers, one way, and
8 without duplicates.
9
11 This documentation refers to Imapsync $Revision: 2.140 $
12
14 To synchronize the source imap account
15 "test1" on server "test1.lamiral.info" with password "secret1"
16 to the destination imap account
17 "test2" on server "test2.lamiral.info" with password "secret2"
18 do:
19
20 imapsync \
21 --host1 test1.lamiral.info --user1 test1 --password1 secret1 \
22 --host2 test2.lamiral.info --user2 test2 --password2 secret2
23
25 We sometimes need to transfer mailboxes from one imap server to one
26 another.
27
28 Imapsync command is a tool allowing incremental and recursive imap
29 transfers from one mailbox to another. If you don't understand the
30 previous sentence, it's normal, it's pedantic computer-oriented jargon.
31
32 All folders are transferred, recursively, meaning the whole folder
33 hierarchy is taken, all messages in them, and all message flags (\Seen
34 \Answered \Flagged etc.) are synced too.
35
36 Imapsync reduces the amount of data transferred by not transferring a
37 given message if it already resides on the destination side. Messages
38 that are on the destination side but not on the source side stay as
39 they are. See the --delete2 option to have strict sync and delete them.
40
41 How imapsync know a message is already on both sides? Same specific
42 headers and the transfer is done only once. By default, the
43 identification headers are "Message-Id:" and "Received:" lines but this
44 choice can be changed with the --useheader option, most often a
45 duplicate problem is solved by using --useheader "Message-Id"
46
47 All flags are preserved, unread messages will stay unread, read ones
48 will stay read, deleted will stay deleted. In the IMAP protocol, a
49 deleted message is not really deleted, it is marked \Deleted and can be
50 undelete. Real destruction comes with the EXPUNGE or UIDEXPUNGE IMAP
51 commands.
52
53 You can abort the transfer at any time and restart it later, imapsync
54 works well with bad connections and interruptions, by design. On a
55 terminal hit Ctr-c twice within two seconds to abort the program. Hit
56 Ctr-c just once makes imapsync reconnect to both imap servers.
57
58 How do you know the sync is finished and well done? When imapsync ends
59 by itself it mentions it with lines like those:
60
61 Exiting with return value 0 (EX_OK: successful termination) 0/50 nb_errors/max_errors PID 301
62 Removing pidfile /tmp/imapsync.pid
63 Log file is LOG_imapsync/2020_11_17_15_59_22_761_test1_test2.txt ( to change it, use --logfile filepath ; or use --nolog to turn off logging )
64
65 If you don't have those lines it means that either the sync process is
66 still running (or eventually hanging indefinitely) or that it ended
67 without a whisper, a strong kill -9 on Linux for example.
68
69 If you have those final lines then it means the sync process is
70 properly finished. It may have encountered problems though.
71
72 A good synchronization is mentioned by some lines above the last ones,
73 especially those three lines:
74
75 The sync looks good, all 1745 identified messages in host1 are on host2.
76 There is no unidentified message on host1.
77 Detected 0 errors
78
79 A classical scenario is synchronizing a mailbox B from another mailbox
80 A where you just want to keep a strict copy of A in B. Strict meaning
81 all messages in A will be in B but no more.
82
83 For this, option --delete2 can be used, it deletes messages in the
84 host2 folder B that are not in the host1 folder A. If you also need to
85 destroy host2 folders that are not in host1 then use --delete2folders.
86 See also --delete2foldersonly and --delete2foldersbutnot to set up
87 exceptions on folders to destroy. INBOX will never be destroyed, it's a
88 mandatory folder in IMAP so imapsync doesn't even try to remove it.
89
90 A different scenario is to delete the messages from the source mailbox
91 after a successful transfer, it can be a good feature when migrating
92 mailboxes since messages will be only on one side. The source account
93 will only have messages that are not on the destination yet, ie,
94 messages that arrived after a sync or that failed to be transferred.
95
96 In that case, use the --delete1 option. Option --delete1 implies also
97 the option --expunge1 so all messages marked deleted on host1 will be
98 deleted. In IMAP protocol deleting a message does not delete it, it
99 marks it with the flag \Deleted, allowing an undelete. Expunging a
100 folder removes, definitively, all the messages marked as \Deleted in
101 this folder.
102
103 You can also decide to remove empty folders once all of their messages
104 have been transferred. Add --delete1emptyfolders to obtain this
105 behavior.
106
107 Imapsync is not adequate for maintaining two active imap accounts in
108 synchronization when the user plays independently on both sides. Use
109 offlineimap (written by John Goerzen) or mbsync (written by Michael R.
110 Elkins) for a 2 ways synchronization.
111
113 usage: imapsync [options]
114
115 The standard options are the six values forming the credentials. Three
116 values on each side are needed in order to login into the IMAP servers.
117 These six values are a hostname, a username, and a password, two times.
118
119 Conventions used in the following descriptions of the options:
120
121 str means string
122 int means integer number
123 flo means float number
124 reg means regular expression
125 cmd means command
126
127 --dry : Makes imapsync doing nothing for real; it just print what
128 would be done without --dry.
129
130 OPTIONS/credentials
131 --host1 str : Source or "from" imap server.
132 --port1 int : Port to connect on host1.
133 Optional since default ports are the
134 well known ports imap/143 or imaps/993.
135 --user1 str : User to login on host1.
136 --password1 str : Password of user1.
137
138 --host2 str : "destination" imap server.
139 --port2 int : Port to connect on host2. Optional
140 --user2 str : User to login on host2.
141 --password2 str : Password of user2.
142
143 --showpasswords : Shows passwords on output instead of "MASKED".
144 Useful to restart a complete run by just reading
145 the command line used in the log,
146 or to debug passwords.
147 It's not a secure practice at all!
148
149 --passfile1 str : Password file for the user1. It must contain the
150 password on the first line. This option avoids showing
151 the password on the command line like --password1 does.
152 --passfile2 str : Password file for the user2.
153
154 You can also pass the passwords in the environment variables
155 IMAPSYNC_PASSWORD1 and IMAPSYNC_PASSWORD2. If you don't pass the user1
156 password via --password1 nor --passfile1 nor $IMAPSYNC_PASSWORD1 then
157 imapsync will prompt to enter the password on the terminal. Same thing
158 for user2 password.
159
160 OPTIONS/encryption
161 --nossl1 : Do not use a SSL connection on host1.
162 --ssl1 : Use a SSL connection on host1. On by default if possible.
163
164 --nossl2 : Do not use a SSL connection on host2.
165 --ssl2 : Use a SSL connection on host2. On by default if possible.
166
167 --notls1 : Do not use a TLS connection on host1.
168 --tls1 : Use a TLS connection on host1. On by default if possible.
169
170 --notls2 : Do not use a TLS connection on host2.
171 --tls2 : Use a TLS connection on host2. On by default if possible.
172
173 --debugssl int : SSL debug mode from 0 to 4.
174
175 --sslargs1 str : Pass any ssl parameter for host1 ssl or tls connection. Example:
176 --sslargs1 SSL_verify_mode=1 --sslargs1 SSL_version=SSLv3
177 See all possibilities in the new() method of IO::Socket::SSL
178 http://search.cpan.org/perldoc?IO::Socket::SSL#Description_Of_Methods
179 --sslargs2 str : Pass any ssl parameter for host2 ssl or tls connection.
180 See --sslargs1
181
182 --timeout1 flo : Connection timeout in seconds for host1.
183 Default is 120 and 0 means no timeout at all.
184 --timeout2 flo : Connection timeout in seconds for host2.
185 Default is 120 and 0 means no timeout at all.
186
187 Caveat, under CGI context, you may encounter a timeout
188 from the webserver, killing imapsync and the imap connexions.
189 See the document INSTALL.OnlineUI.txt and search
190 for "Timeout" for how to deal with this issue.
191
192 OPTIONS/authentication
193 --authmech1 str : Auth mechanism to use with host1:
194 PLAIN, LOGIN, CRAM-MD5 etc. Use UPPERCASE.
195 --authmech2 str : Auth mechanism to use with host2. See --authmech1
196
197 --authuser1 str : User to auth with on host1 (admin user).
198 Avoid using --authmech1 SOMETHING with --authuser1.
199 --authuser2 str : User to auth with on host2 (admin user).
200 --proxyauth1 : Use proxyauth on host1. Requires --authuser1.
201 Required by Sun/iPlanet/Netscape IMAP servers to
202 be able to use an administrative user.
203 --proxyauth2 : Use proxyauth on host2. Requires --authuser2.
204
205 --authmd51 : Use MD5 authentication for host1.
206 --authmd52 : Use MD5 authentication for host2.
207 --domain1 str : Domain on host1 (NTLM authentication).
208 --domain2 str : Domain on host2 (NTLM authentication).
209
210 --oauthaccesstoken1 str : The access token to authenticate with OAUTH2.
211 It will be combined with the --user1 value to form the
212 string to pass with XOAUTH2 authentication.
213 The password given by --password1 or --passfile1
214 is ignored.
215 Instead of the access token itself, the value can be a
216 file containing the access token on the first line.
217 If the value is a file, imapsync reads its first line
218 and take this line as the access token. The advantage
219 of the file is that if the access token changes then
220 imapsync can read it again when it needs to reconnect
221 during a run.
222
223
224 --oauthaccesstoken2 str : same thing as --oauthaccesstoken1
225
226 --oauthdirect1 str : The direct string to pass with XOAUTH2 authentication.
227 The password given by --password1 or --passfile1 and
228 the user given by --user1 are ignored.
229
230 --oauthdirect2 str : same thing as oauthdirect1
231
232 OPTIONS/folders
233 --folder str : Sync this folder.
234 --folder str : and this one, etc.
235 --folderrec str : Sync this folder recursively.
236 --folderrec str : and this one, etc.
237
238 --folderfirst str : Sync this folder first. Ex. --folderfirst "INBOX"
239 --folderfirst str : then this one, etc.
240 --folderlast str : Sync this folder last. --folderlast "[Gmail]/All Mail"
241 --folderlast str : then this one, etc.
242
243 --nomixfolders : Do not merge folders when host1 is case-sensitive
244 while host2 is not (like Exchange). Only the first
245 similar folder is synced (example: with folders
246 "Sent", "SENT" and "sent"
247 on host1 only "Sent" will be synced to host2).
248
249 --skipemptyfolders : Empty host1 folders are not created on host2.
250
251 --include reg : Sync folders matching this regular expression
252 --include reg : or this one, etc.
253 If both --include --exclude options are used, then
254 include is done before.
255 --exclude reg : Skips folders matching this regular expression
256 Several folders to avoid:
257 --exclude 'fold1|fold2|f3' skips fold1, fold2 and f3.
258 --exclude reg : or this one, etc.
259
260 --automap : guesses folders mapping, for folders well known as
261 "Sent", "Junk", "Drafts", "All", "Archive", "Flagged".
262
263 --f1f2 str1=str2 : Force folder str1 to be synced to str2,
264 --f1f2 overrides --automap and --regextrans2.
265 Use several --f1f2 options to map several folders.
266 Option --f1f2 is a one to one only folder mapping,
267 str1 and str2 have to be full path folder names.
268
269 --subfolder2 str : Syncs the whole host1 folders hierarchy under the
270 host2 folder named str.
271 It does it internally by adding three
272 --regextrans2 options before all others.
273 Add --debug to see what's really going on.
274
275 --subfolder1 str : Syncs the host1 folders hierarchy which is under folder
276 str to the root hierarchy of host2.
277 It's the couterpart of a sync done by --subfolder2
278 when doing it in the reverse order.
279 Backup/Restore scenario:
280 Use --subfolder2 str for a backup to the folder str
281 on host2. Then use --subfolder1 str for restoring
282 from the folder str, after inverting
283 host1/host2 user1/user2 values.
284
285
286 --subscribed : Transfers subscribed folders.
287 --subscribe : Subscribe to the folders transferred on the
288 host2 that are subscribed on host1. On by default.
289 --subscribeall : Subscribe to the folders transferred on the
290 host2 even if they are not subscribed on host1.
291
292 --prefix1 str : Remove prefix str to all destination folders,
293 usually "INBOX." or "INBOX/" or an empty string "".
294 imapsync guesses the prefix if host1 imap server
295 does not have NAMESPACE capability. So this option
296 should not be used most of the time.
297 --prefix2 str : Add prefix to all host2 folders. See --prefix1
298
299 --sep1 str : Host1 separator. This option should not be used
300 most of the time.
301 Imapsync gets the separator from the server itself,
302 by using NAMESPACE, or it tries to guess it
303 from the folders listing (it counts
304 characters / . \\ \ in folder names and choose the
305 more frequent, or finally / if nothing is found.
306 --sep2 str : Host2 separator. See --sep1
307
308 --regextrans2 reg : Apply the whole regex to each destination folders.
309 --regextrans2 reg : and this one. etc.
310 When you play with the --regextrans2 option, first
311 add also the safe options --dry --justfolders
312 Then, when happy, remove --dry for a run, then
313 remove --justfolders for the next ones.
314 Have in mind that --regextrans2 is applied after
315 the automatic prefix and separator inversion.
316 For examples see:
317 https://imapsync.lamiral.info/FAQ.d/FAQ.Folders_Mapping.txt
318
319 OPTIONS/folders sizes
320 --nofoldersizes : Do not calculate the size of each folder at the
321 beginning of the sync. Default is to calculate them.
322 --nofoldersizesatend: Do not calculate the size of each folder at the
323 end of the sync. Default is to calculate them.
324 --justfoldersizes : Exit after having printed the initial folder sizes.
325
326 OPTIONS/tmp
327 --tmpdir str : Where to store temporary files and subdirectories.
328 Will be created if it doesn't exist.
329 Default is system specific, Unix is /tmp but
330 /tmp is often too small and deleted at reboot.
331 --tmpdir /var/tmp should be better.
332
333 --pidfile str : The file where imapsync pid is written,
334 it can be dirname/filename complete path.
335 The default name is imapsync.pid in tmpdir.
336
337 --pidfilelocking : Abort if pidfile already exists. Useful to avoid
338 concurrent transfers on the same mailbox.
339
340 OPTIONS/log
341 --nolog : Turn off logging on file
342 --logfile str : Change the default log filename (can be dirname/filename).
343 --logdir str : Change the default log directory. Default is LOG_imapsync/
344
345 The default logfile name is for example
346
347 LOG_imapsync/2019_12_22_23_57_59_532_user1_user2.txt
348
349 where:
350
351 2019_12_22_23_57_59_532 is nearly the date of the start
352 YYYY_MM_DD_HH_MM_SS_mmm
353 year_month_day_hour_minute_seconde_millisecond
354
355 and user1 user2 are the --user1 --user2 values.
356
357 OPTIONS/messages
358 --skipmess reg : Skips messages matching the regex.
359 Example: 'm/[\x80-\xff]/' # to avoid 8bits messages.
360 --skipmess is applied before --regexmess
361 --skipmess reg : or this one, etc.
362
363 --skipcrossduplicates : Avoid copying messages that are already copied
364 in another folder, good from Gmail to XYZ when
365 XYZ is not also Gmail.
366 Activated with --gmail1 unless --noskipcrossduplicates
367
368 --debugcrossduplicates : Prints which messages (UIDs) are skipped with
369 --skipcrossduplicates and in what other folders
370 they are.
371
372 --pipemess cmd : Apply this cmd command to each message content
373 before the copy.
374 --pipemess cmd : and this one, etc.
375 With several --pipemess, the output of each cmd
376 command (STDOUT) is given to the input (STDIN)
377 of the next command.
378 For example,
379 --pipemess cmd1 --pipemess cmd2 --pipemess cmd3
380 is like a Unix pipe:
381 "cat message | cmd1 | cmd2 | cmd3"
382
383 --disarmreadreceipts : Disarms read receipts (host2 Exchange issue)
384
385 --regexmess reg : Apply the whole regex to each message before transfer.
386 Example: 's/\000/ /g' # to replace null characters
387 by spaces.
388 --regexmess reg : and this one, etc.
389
390 OPTIONS/labels
391 Gmail present labels as folders in imap. Imapsync can accelerate the
392 sync by syncing X-GM-LABELS, it will avoid to transfer messages when
393 they are already on host2 in another folder.
394
395 --synclabels : Syncs also Gmail labels when a message is copied to host2.
396 Activated by default with --gmail1 --gmail2 unless
397 --nosynclabels is added.
398
399 --resynclabels : Resyncs Gmail labels when a message is already on host2.
400 Activated by default with --gmail1 --gmail2 unless
401 --noresynclabels is added.
402
403 For Gmail syncs, see also:
404 https://imapsync.lamiral.info/FAQ.d/FAQ.Gmail.txt
405
406 OPTIONS/flags
407 If you encounter flag problems see also:
408 https://imapsync.lamiral.info/FAQ.d/FAQ.Flags.txt
409
410 --regexflag reg : Apply the whole regex to each flags list.
411 Example: 's/"Junk"//g' # to remove "Junk" flag.
412 --regexflag reg : then this one, etc.
413
414 --resyncflags : Resync flags for already transferred messages.
415 On by default.
416 --noresyncflags : Do not resync flags for already transferred messages.
417 May be useful when a user has already started to play
418 with its host2 account.
419
420 --filterbuggyflags : Filter flags known to be buggy and generators of errors
421 "BAD Invalid system flag" or "NO APPEND Invalid flag list".
422
423 OPTIONS/deletions
424 --delete1 : Deletes messages on host1 server after a successful
425 transfer. Option --delete1 has the following behavior:
426 it marks messages as deleted with the IMAP flag
427 \Deleted, then messages are really deleted with an
428 EXPUNGE IMAP command. If expunging after each message
429 slows down too much the sync then use
430 --noexpungeaftereach to speed up, expunging will then be
431 done only twice per folder, one at the beginning and
432 one at the end of a folder sync.
433
434 --expunge1 : Expunge messages on host1 just before syncing a folder.
435 Expunge is done per folder.
436 Expunge aims is to really delete messages marked deleted.
437 An expunge is also done after each message copied
438 if option --delete1 is set (unless --noexpungeaftereach).
439
440 --noexpunge1 : Do not expunge messages on host1.
441
442 --delete1emptyfolders : Deletes empty folders on host1, INBOX excepted.
443 Useful with --delete1 since what remains on host1
444 is only what failed to be synced.
445
446 --delete2 : Delete messages in the host2 account that are not in
447 the host1 account. Useful for backup or pre-sync.
448 --delete2 implies --uidexpunge2
449
450 --delete2duplicates : Deletes messages in host2 that are duplicates in host2.
451 Works only without --useuid since duplicates are
452 detected with an header part of each message.
453 NB: --delete2duplicates is far less violent than --delete2
454 since it removes only duplicates.
455
456 --delete2folders : Delete folders in host2 that are not in host1.
457 For safety, first try it like this, it is safe:
458 --delete2folders --dry --justfolders --nofoldersizes
459 and see what folders will be deleted.
460
461 --delete2foldersonly reg : Delete only folders matching the regex reg.
462 Example: --delete2foldersonly "/^Junk$|^INBOX.Junk$/"
463 This option activates --delete2folders
464
465 --delete2foldersbutnot reg : Do not delete folders matching the regex rex.
466 Example: --delete2foldersbutnot "/Tasks$|Contacts$|Foo$/"
467 This option activates --delete2folders
468
469 --noexpunge2 : Do not expunge messages on host2.
470 --nouidexpunge2 : Do not uidexpunge messages on the host2 account
471 that are not on the host1 account.
472
473 OPTIONS/dates
474 If you encounter problems with dates, see also:
475 https://imapsync.lamiral.info/FAQ.d/FAQ.Dates.txt
476
477 --syncinternaldates : Sets the internal dates on host2 as the same as host1.
478 Turned on by default. Internal date is the date
479 a message arrived on a host (Unix mtime usually).
480 --idatefromheader : Sets the internal dates on host2 as same as the
481 ones in "Date:" headers.
482
483 OPTIONS/message selection
484 --maxsize int : Skip messages larger (or equal) than int bytes
485 --minsize int : Skip messages smaller (or equal) than int bytes
486
487 --maxage int : Skip messages older than int days.
488 final stats (skipped) don't count older messages
489 see also --minage
490 --minage int : Skip messages newer than int days.
491 final stats (skipped) don't count newer messages
492 You can do (+ zone are the messages selected):
493 past|----maxage+++++++++++++++>now
494 past|+++++++++++++++minage---->now
495 past|----maxage+++++minage---->now (intersection)
496 past|++++minage-----maxage++++>now (union)
497
498 --search str : Selects only messages returned by this IMAP SEARCH
499 command. Applied on both sides.
500 For a complete set of what can be search see
501 https://imapsync.lamiral.info/FAQ.d/FAQ.Messages_Selection.txt
502
503 --search1 str : Same as --search but for selecting host1 messages only.
504 --search2 str : Same as --search but for selecting host2 messages only.
505 So --search CRIT equals --search1 CRIT --search2 CRIT
506
507 --noabletosearch : Makes --minage and --maxage options use the internal
508 dates given by a FETCH imap command instead of the
509 "Date:" header. Internal date is the arrival date
510 in the mailbox.
511 --noabletosearch equals --noabletosearch1 --noabletosearch2
512
513 --noabletosearch1 : Like --noabletosearch but for host1 only.
514 --noabletosearch2 : Like --noabletosearch but for host2 only.
515
516 --maxlinelength int : skip messages with a line length longer than int bytes.
517 RFC 2822 says it must be no more than 1000 bytes but
518 real life servers and email clients do more.
519
520
521 --useheader str : Use this header to compare messages on both sides.
522 Example: "Message-Id" or "Received" or "Date".
523 --useheader str and this one, etc.
524
525 --syncduplicates : Sync also duplicates. Off by default.
526
527 --usecache : Use cache to speed up next syncs. Off by default.
528 --nousecache : Do not use cache. Caveat: --useuid --nousecache creates
529 duplicates on multiple runs.
530
531 --useuid : Use UIDs instead of headers as a criterion to recognize
532 messages. Option --usecache is then implied unless
533 --nousecache is used.
534
535 OPTIONS/miscellaneous
536 --syncacls : Synchronizes acls (Access Control Lists).
537 Acls in IMAP are not standardized, be careful
538 since one acl code on one side may signify something
539 else on the other one.
540 --nosyncacls : Does not synchronize acls. This is the default.
541
542 --addheader : When a message has no headers to be identified,
543 --addheader adds a "Message-Id" header,
544 like "Message-Id: 12345@imapsync", where 12345
545 is the imap UID of the message on the host1 folder.
546 Useful to sync folders "Sent" or "Draft".
547
548 OPTIONS/debugging
549 --debug : Debug mode.
550 --debugfolders : Debug mode for the folders part only.
551 --debugcontent : Debug content of the messages transferred. Huge output.
552 --debugflags : Debug mode for flags.
553 --debugimap1 : IMAP debug mode for host1. Very verbose.
554 --debugimap2 : IMAP debug mode for host2. Very verbose.
555 --debugimap : IMAP debug mode for host1 and host2. Twice very verbose.
556 --debugmemory : Debug mode showing memory consumption after each copy.
557
558 --errorsmax int : Exit when int number of errors is reached. Default is 50.
559
560 --tests : Run local non-regression tests. Exit code 0 means all ok.
561 --testslive : Run a live test with test1.lamiral.info imap server.
562 Useful to check the basics. Needs internet connection.
563 --testslive6 : Run a live test with ks6ipv6.lamiral.info imap server.
564 Useful to check the ipv6 connectivity. Needs internet.
565
566 OPTIONS/specific
567 --gmail1 : sets --host1 to Gmail and other options. See FAQ.Gmail.txt
568 --gmail2 : sets --host2 to Gmail and other options. See FAQ.Gmail.txt
569
570 --office1 : sets --host1 to Office365 and other options. See FAQ.Office365.txt
571 --office2 : sets --host2 to Office365 and other options. See FAQ.Office365.txt
572
573 --exchange1 : sets options for Exchange. See FAQ.Exchange.txt
574 --exchange2 : sets options for Exchange. See FAQ.Exchange.txt
575
576 --domino1 : sets options for Domino. See FAQ.Domino.txt
577 --domino2 : sets options for Domino. See FAQ.Domino.txt
578
579 OPTIONS/behavior
580 --maxmessagespersecond flo : limits the average number of messages
581 transferred per second.
582
583 --maxbytespersecond int : limits the average transfer rate per second.
584 --maxbytesafter int : starts --maxbytespersecond limitation only after
585 --maxbytesafter amount of data transferred.
586
587 --maxsleep flo : do not sleep more than int seconds.
588 On by default, 2 seconds max, like --maxsleep 2
589
590 --abort : terminates a previous call still running.
591 It uses the pidfile to know what process to abort.
592
593 --exitwhenover int : Stop syncing and exits when int total bytes
594 transferred is reached.
595
596 --version : Print only the software version.
597 --noreleasecheck : Do not check for any new imapsync release.
598 --releasecheck : Check for new imapsync release.
599 it's an http request to
600 http://imapsync.lamiral.info/prj/imapsync/VERSION
601
602 --noid : Do not send/receive IMAP "ID" command to imap servers.
603
604 --justconnect : Just connect to both servers and print useful
605 information. Need only --host1 and --host2 options.
606 Obsolete since "imapsync --host1 imaphost" alone
607 implies --justconnect
608
609 --justlogin : Just login to both host1 and host2 with users
610 credentials, then exit.
611
612 --justfolders : Do only things about folders (ignore messages).
613
614 --help : print this help.
615
616 Example: to synchronize imap account "test1" on "test1.lamiral.info"
617 to imap account "test2" on "test2.lamiral.info"
618 with test1 password "secret1"
619 and test2 password "secret2"
620
621 imapsync \
622 --host1 test1.lamiral.info --user1 test1 --password1 secret1 \
623 --host2 test2.lamiral.info --user2 test2 --password2 secret2
624
626 You can use --passfile1 instead of --password1 to mention the password
627 since it is safer. With --password1 option, on Linux, any user on your
628 host can see the password by using the 'ps auxwwww' command. Using a
629 variable (like IMAPSYNC_PASSWORD1) is also dangerous because of the 'ps
630 auxwwwwe' command. So, saving the password in a well protected file
631 (600 or rw-------) is the best solution.
632
633 Imapsync activates ssl or tls encryption by default, if possible.
634
635 What detailed behavior is under this "if possible"?
636
637 Imapsync activates ssl if the well known port imaps port (993) is open
638 on the imap servers. If the imaps port is closed then it open a normal
639 (clear) connection on port 143 but it looks for TLS support in the
640 CAPABILITY list of the servers. If TLS is supported then imapsync goes
641 to encryption with STARTTLS.
642
643 If the automatic ssl and the tls detections fail then imapsync will not
644 protect against sniffing activities on the network, especially for
645 passwords.
646
647 If you want to force ssl or tls just use --ssl1 --ssl2 or --tls1 --tls2
648
649 See also the document FAQ.Security.txt in the FAQ.d/ directory or at
650 https://imapsync.lamiral.info/FAQ.d/FAQ.Security.txt
651
653 Imapsync will exit with a 0 status (return code) if everything went
654 good. Otherwise, it exits with a non-zero status. That's classical
655 Unix behavior. Here is the list of the exit code values (an integer
656 between 0 and 255). In Bourne Shells, this exit code value can be
657 retrieved within the variable value "$?" if you read it just after the
658 imapsync call.
659
660 The names reflect their meaning:
661
662 EX_OK => 0 ; #/* successful termination */
663 EX_USAGE => 64 ; #/* command line usage error */
664 EX_NOINPUT => 66 ; #/* cannot open input */
665 EX_UNAVAILABLE => 69 ; #/* service unavailable */
666 EX_SOFTWARE => 70 ; #/* internal software error */
667 EXIT_CATCH_ALL => 1 ; # Any other error
668 EXIT_BY_SIGNAL => 6 ; # Should be 128+n where n is the sig_num
669 EXIT_BY_FILE => 7 ;
670 EXIT_PID_FILE_ERROR => 8 ;
671 EXIT_CONNECTION_FAILURE => 10 ;
672 EXIT_TLS_FAILURE => 12 ;
673 EXIT_AUTHENTICATION_FAILURE => 16 ;
674 EXIT_SUBFOLDER1_NO_EXISTS => 21 ;
675 EXIT_WITH_ERRORS => 111 ;
676 EXIT_WITH_ERRORS_MAX => 112 ;
677 EXIT_OVERQUOTA => 113 ;
678 EXIT_ERR_APPEND => 114 ;
679 EXIT_ERR_FETCH => 115 ;
680 EXIT_ERR_CREATE => 116 ;
681 EXIT_ERR_SELECT => 117 ;
682 EXIT_TRANSFER_EXCEEDED => 118 ;
683 EXIT_ERR_APPEND_VIRUS => 119 ;
684 EXIT_TESTS_FAILED => 254 ; # Like Test::More API
685 EXIT_CONNECTION_FAILURE_HOST1 => 101 ;
686 EXIT_CONNECTION_FAILURE_HOST2 => 102 ;
687 EXIT_AUTHENTICATION_FAILURE_USER1 => 161 ;
688 EXIT_AUTHENTICATION_FAILURE_USER2 => 162 ;
689
691 Imapsync is free, open, public but not always gratis software cover by
692 the NOLIMIT Public License, now called NLPL. See the LICENSE file
693 included in the distribution or just read this simple sentence as it IS
694 the licence text:
695
696 "No limits to do anything with this work and this license."
697
698 In case it is not long enough, I repeat:
699
700 "No limits to do anything with this work and this license."
701
702 Look at https://imapsync.lamiral.info/LICENSE
703
705 Gilles LAMIRAL <gilles@lamiral.info>
706
707 Good feedback is always welcome. Bad feedback is very often welcome.
708
709 Gilles LAMIRAL earns his living by writing, installing, configuring and
710 sometimes teaching free, open and often gratis software. Imapsync used
711 to be "always gratis" but now it is only "often gratis" because
712 imapsync is sold by its author, your servitor, a good way to maintain
713 and support free open public software tools over decades.
714
716 See https://imapsync.lamiral.info/FAQ.d/FAQ.Reporting_Bugs.txt
717
719 See https://imapsync.lamiral.info/S/imapservers.shtml
720
722 If you have many mailboxes to migrate think about a little shell
723 program. Write a file called file.txt (for example) containing users
724 and passwords. The separator used in this example is ';'
725
726 The file.txt file contains:
727
728 user001_1;password001_1;user001_2;password001_2
729 user002_1;password002_1;user002_2;password002_2
730 user003_1;password003_1;user003_2;password003_2
731 user004_1;password004_1;user004_2;password004_2
732 user005_1;password005_1;user005_2;password005_2 ...
733
734 On Unix the shell program can be:
735
736 { while IFS=';' read u1 p1 u2 p2; do
737 imapsync --host1 imap.side1.org --user1 "$u1" --password1 "$p1" \
738 --host2 imap.side2.org --user2 "$u2" --password2 "$p2" ...
739 done ; } < file.txt
740
741 On Windows the batch program can be:
742
743 FOR /F "tokens=1,2,3,4 delims=; eol=#" %%G IN (file.txt) DO imapsync ^
744 --host1 imap.side1.org --user1 %%G --password1 %%H ^
745 --host2 imap.side2.org --user2 %%I --password2 %%J ...
746
747 The ... have to be replaced by nothing or any imapsync option. Welcome
748 in shell or batch programming !
749
750 You will find already written scripts at
751 https://imapsync.lamiral.info/examples/
752
754 Imapsync works under any Unix with Perl.
755
756 Imapsync works under most Windows (2000, XP, Vista, Seven, Eight, Ten
757 and all Server releases 2000, 2003, 2008 and R2, 2012 and R2, 2016)
758 as a standalone binary software called imapsync.exe,
759 usually launched from a batch file in order to avoid always typing
760 the options. There is also a 32bit binary called imapsync_32bit.exe
761
762 Imapsync works under OS X as a standalone binary
763 software called imapsync_bin_Darwin
764
765 Purchase latest imapsync at
766 https://imapsync.lamiral.info/
767
768 You'll receive a link to a compressed tarball called imapsync-x.xx.tgz
769 where x.xx is the version number. Untar the tarball where
770 you want (on Unix):
771
772 tar xzvf imapsync-x.xx.tgz
773
774 Go into the directory imapsync-x.xx and read the INSTALL file.
775 As mentioned at https://imapsync.lamiral.info/#install
776 the INSTALL file can also be found at
777 https://imapsync.lamiral.info/INSTALL.d/INSTALL.ANY.txt
778 It is now split in several files for each system
779 https://imapsync.lamiral.info/INSTALL.d/
780
782 There is no specific configuration file for imapsync, everything is
783 specified by the command line parameters and the default behavior.
784
786 Feel free to hack imapsync as the NOLIMIT license permits it.
787
789 See also https://imapsync.lamiral.info/S/external.shtml
790 for a better up to date list.
791
792 List verified on Friday July 1, 2021.
793
794 imapsync: https://github.com/imapsync/imapsync (this is an imapsync copy, sometimes delayed, with --noreleasecheck by default since release 1.592, 2014/05/22)
795 imap_tools: https://web.archive.org/web/20161228145952/http://www.athensfbc.com/imap_tools/. The imap_tools code is now at https://github.com/andrewnimmo/rick-sanders-imap-tools
796 imaputils: https://github.com/mtsatsenko/imaputils (very old imap_tools fork)
797 Doveadm-Sync: https://wiki2.dovecot.org/Tools/Doveadm/Sync ( Dovecot sync tool )
798 davmail: http://davmail.sourceforge.net/
799 offlineimap: http://offlineimap.org/
800 fdm: https://github.com/nicm/fdm
801 mbsync: http://isync.sourceforge.net/
802 mailsync: http://mailsync.sourceforge.net/
803 mailutil: https://www.washington.edu/imap/ part of the UW IMAP toolkit. (well, seems abandoned now)
804 imaprepl: https://bl0rg.net/software/ http://freecode.com/projects/imap-repl/
805 imapcopy (Pascal): http://www.ardiehl.de/imapcopy/
806 imapcopy (Java): https://code.google.com/archive/p/imapcopy/
807 imapsize: http://www.broobles.com/imapsize/
808 migrationtool: http://sourceforge.net/projects/migrationtool/
809 imapmigrate: http://sourceforge.net/projects/cyrus-utils/
810 larch: https://github.com/rgrove/larch (derived from wonko_imapsync, good at Gmail)
811 wonko_imapsync: http://wonko.com/article/554 (superseded by larch)
812 pop2imap: http://www.linux-france.org/prj/pop2imap/ (I wrote that too)
813 exchange-away: http://exchange-away.sourceforge.net/
814 SyncBackPro: http://www.2brightsparks.com/syncback/sbpro.html
815 ImapSyncClient: https://github.com/ridaamirini/ImapSyncClient
816 MailStore: https://www.mailstore.com/en/products/mailstore-home/
817 mnIMAPSync: https://github.com/manusa/mnIMAPSync
818 imap-upload: http://imap-upload.sourceforge.net/ (A tool for uploading a local mbox file to IMAP4 server)
819 imapbackup: https://github.com/rcarmo/imapbackup (A Python script for incremental backups of IMAP mailboxes)
820 BitRecover email-backup 99 USD, 299 USD https://www.bitrecover.com/email-backup/.
821 ImportExportTools: https://addons.thunderbird.net/en-us/thunderbird/addon/importexporttools/ ImportExportTools for Mozilla Thunderbird by Paolo Kaosmos. ImportExportTools does not do IMAP.
822 rximapmail: https://sourceforge.net/projects/rximapmail/
823 CodeTwo: https://www.codetwo.com/ but CodeTwo does imap source to Office365 only.
824
826 I initially wrote imapsync in July 2001 because an enterprise, called
827 BaSystemes, paid me to install a new imap server without losing huge
828 old mailboxes located in a far away remote imap server, accessible by
829 an often broken low-bandwidth ISDN link.
830
831 I had to verify every mailbox was well transferred, all folders, all
832 messages, without wasting bandwidth or creating duplicates upon
833 resyncs. The imapsync design was made with the beautiful rsync command
834 in mind.
835
836 Imapsync started its life as a patch of the copy_folder.pl script. The
837 script copy_folder.pl comes from the Mail-IMAPClient-2.1.3 perl module
838 tarball source (more precisely in the examples/ directory of the Mail-
839 IMAPClient tarball).
840
841 So many changes happened since then that I wonder if it remains any
842 lines of the original copy_folder.pl in imapsync source code.
843
844
845
846perl v5.34.0 2022-02-07 IMAPSYNC(1)