forked from imapsync/imapsync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFAQ
1378 lines (960 loc) · 45.3 KB
/
FAQ
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/cat
# $Id: FAQ,v 1.104 2012/02/20 18:23:29 gilles Exp gilles $
+------------------+
| FAQ for imapsync |
+------------------+
http://imapsync.lamiral.info/FAQ
Unix versus Windows syntax.
A) \ versus ^
On Unix shells you can write a single command on multiple lines
by using the escape character \ at the end of each line
(except the last one). On Windows this character is ^
Unix example:
./imapsync \
--host1 imap.truc.org --user1 foo --password1 secret1 \
--host2 imap.trac.org --user2 bar --password2 secret2
Windows example:
imapsync ^
--host1 imap.truc.org --user1 foo --password1 secret1 ^
--host2 imap.trac.org --user2 bar --password2 secret2
Of course you can write the command on one only line without
characters \ nor ^. I use them because the output is
better, no truncation, pretty print. It's just sugar.
In this FAQ I use \ for examples. Transcript to ^ if
you're on a Windows system.
B) ' versus "
On Windows the single quote character ' doesn't work
like on Unix so in the examples of this FAQ the
command containing single quotes ' will fail on Windows.
To fix it just replace single quotes ' by double quotes "
=======================================================================
Q. How to install imapsync?
R. Read the INSTALL file in the tarball also available at
http://imapsync.lamiral.info/INSTALL
=======================================================================
Q. How to configure and run imapsync?
R. Read the README and FAQ files in the tarball also available at
http://imapsync.lamiral.info/README
http://imapsync.lamiral.info/FAQ
=======================================================================
Q. Can you give some configuration examples?
R. The FAQ file contains many examples for several scenarios
http://www.linux-france.org/prj/imapsync/FAQ
=======================================================================
Q. How can I have commercial support?
R. Buy support from imapsync author and expert: Gilles LAMIRAL
http://imapsync.lamiral.info/#buy_support
=======================================================================
Q. How can I have gratis support?
R. Use the mailing-list
To write on the mailing-list, the address is:
To subscribe, send a message to:
To unsubscribe, send a message to:
To contact the person in charge for the list:
The list archives may be available at:
http://www.linux-france.org/prj/imapsync_list/
So consider that the list is public, anyone
can see your post. Use a pseudonym or do not
post to this list if you want to stay private.
Thank you for your participation.
=======================================================================
Q. I need to migrate hundred accounts, how can I do?
R. If you have many mailboxes to migrate think about a little
shell program. Write a file called file.txt (for example)
containing users and passwords.
The separator used in this example is ';'
The file.txt file contains:
user001_1;password001_1;user001_2;password001_2
user002_1;password002_1;user002_2;password002_2
user003_1;password003_1;user003_2;password003_2
user004_1;password004_1;user004_2;password004_2
user005_1;password005_1;user005_2;password005_2
...
On Unix the shell program can be:
{ while IFS=';' read u1 p1 u2 p2; do
imapsync --host1 imap.side1.org --user1 "$u1" --password1 "$p1" \
--host2 imap.side2.org --user2 "$u2" --password2 "$p2" ...
done ; } < file.txt
On Windows the batch program can be:
FOR /F "tokens=1,2,3,4 delims=; eol=#" %%G IN (file.txt) DO imapsync ^
--host1 imap.side1.org --user1 %%G --password1 %%H ^
--host2 imap.side2.org --user2 %%I --password2 %%J ...
The ... can be replaced by nothing or any supplementary imapsync option.
=======================================================================
Q. Where I can find old imapsync releases?
R. Search the internet.
=======================================================================
Q. Where I can find free open and gratis imapsync releases?
R. Search the internet.
Q. Is is legal?
R. Yes, the license permits it
http://imapsync.lamiral.info/COPYING
=======================================================================
Q. I use --useuid which uses a cache in /tmp or --tmpdir, the hostnames
host1 or host2 has changed but mailboxes are the same. Will imapsync
generate duplicate messages on next runs?
R. Yes
Q. How can I fix this?
R. The cache path reflects hostnames or ip adresses, just change the
directory names of host1 or host2. Use --dry to see if next runs
will generate duplucates.
By default the cache is like
/tmp/imapsync_cache/host1/user1/host2/user2/...
=======================================================================
Q. How can I speed up transfers?
R. By using --useuid imapsync avoid getting messages headers and build
a cache. On Unix a good thing is to add also --tmpdir /var/tmp
to keep the cache since /tmp is often cleared on reboot.
imapsync ... --useuid
R. Add also --nofoldersizes since the default behavior is to compute
folder sizes. Folder sizes are useless for the transfer, just
useful to see what has to be done on each folder.
=======================================================================
Q. I see warning messages like
"Host1 Sent/15 size 1428 ignored (no header so we ignore this message)"
What can I do to transfer those messages?
R1. Use --addheader option, it will add a header like
"Message-Id: <15@imapsync>" and transfer the message on host2.
Duplicates won't happen in next runs.
imapsync ... --addheader
R2. Use --useuid then imapsync will avoid dealing with headers.
imapsync ... --useuid
=======================================================================
Q. How can I try imapsync with the new Mail::IMAPClient 3.xx perl library?
R. - Download latest Mail::IMAPClient 3.xx at
http://search.cpan.org/dist/Mail-IMAPClient/
- untar it anywhere:
tar xzvf Mail-IMAPClient-3.xx.tar.gz
- Get any imapsync (latest is better).
- run imapsync with perl and -I option tailing to use the perl
module Mail-IMAPClient-3.xx. Example:
perl -I./Mail-IMAPClient-3.30/lib ./imapsync ...
or if imapsync is in directory /path/
perl -I./Mail-IMAPClient-3.30/lib /path/imapsync ...
- Look at the script named i3 in the tarball, it can be used to
run imapsync with included Mail-IMAPClient-3.30/ wherever you
unpacked the imapsync tarball
=======================================================================
Q. How can I use imapsync with Mail::IMAPClient 2.2.9 perl module?
R. - Download Mail::IMAPClient 2.2.9 at
http://search.cpan.org/~djkernen/Mail-IMAPClient-2.2.9/
http://search.cpan.org/CPAN/authors/id/D/DJ/DJKERNEN/Mail-IMAPClient-2.2.9.tar.gz
- untar it anywhere:
tar xzvf Mail-IMAPClient-2.2.9.tar.gz
- run imapsync with perl and -I option tailing to use Mail-IMAPClient-2.2.9:
perl -I./Mail-IMAPClient-2.2.9 ./imapsync [...]
or if imapsync is in directory /path/
perl -I./Mail-IMAPClient-2.2.9 /path/imapsync [...]
- Look at the script named i2 in the tarball, it can be used to
run imapsync with included Mail-IMAPClient-2.2.9/ wherever you
unpacked the imapsync tarball
=======================================================================
Q. Can I use imapsync to migrate emails from pop3 server to imap server?
R1. No.
You can migrate emails from pop server to imap server with pop2imap:
http://www.linux-france.org/prj/pop2imap/
R2. Yes
Many pop3 servers runs in parallel with an imap server on the
exactly the same mailboxes. They serve the same INBOX
(imap serves INBOX and several other folders, pop3 serves only INBOX)
So have a try with imapsync on the same host1.
=======================================================================
Q. I am interested in creating a local clone of the IMAP on a LAN
server for faster synchronisations, email will always be delivered
to the remote server and so the synchronisation will be one way - from
remote to local. How suited is imapsync for continuous one-way
synchronisation of mailboxes? Is there a better solution?
R. If messages are delivered remotely and you play locally with the
copy, in order to have fast access, then the synchronisation can't
be one way. You may change flags, you may move messages in
different folders etc.
A better tool with this scenario is offlineimap,
designed for this issue, and faster than imapsync.
=======================================================================
Q. We have found that the sent time and date have been changed to the
time at which the file was synchronised.
R. This is the case with:
- Eudora
- Zimbra
- Outlook 2003
- Gmail
but not with
- Mutt
- Thunderbird
Eurora shows by default the time the imap server received the email. I
think it is quite a wrong behavior since the messages can have
travelled some time before the reception.
The sent time and date are given by the "Date:" header and it is set
most of the time by the MUA (Mail User Agent, Mutt, Eudora,
Thunderbird etc.).
imapsync does not touch any byte of messages unless told to do so
by an option. Messages on both parts should be identical
(some IMAP servers add or even change header lines).
Solutions:
a) Use the --syncinternaldates option and keep using Eudora.
But --syncinternaldates is now turn on by default so if you
encounter the issue then the solution is harder, depending
on email client softwares and IMAP server softwares.
b) use --idatefromheader to set the internal dates on host2 same as the
"Date:" headers. It won't work if a) doesn't work.
c) In Maildir boxes, after the sync (too late...), use the script
learn/adjust_time.pl to change the internal dates from the "Date:" header.
(this a Unix fix using touch command)
d) Use a better email client or configure it in order it sorts messages
by sent date.
=======================================================================
Q. imapsync calculates 479 messages in a folder but only transfers 400
messages. What's happen?
R1. Unless --useuid is used, imapsync considers a header part
of a message to identify a message on both sides.
The header part is whole header with "--useheader ALL" or
only specific lines depending on --useheader --skipheader
or default values.
Consequences:
1) Duplicate messages (identical header) are not transferred
several times.
The result is that you can have more messages on host1 than on host2.
R2. With option --useuid imapsync doesn't use headers to identify
messages on both sides but it uses their imap uid. In that case
duplicates on host1 are transfered on host2.
=======================================================================
Q. I need to log every output on a file named log.txt
R. Use redirections of both standard and error outputs "> log.txt 2>&1"
imapsync ... > log.txt 2>&1
=======================================================================
Q. I need to log every output on a file named log.txt and also to the
screen in order to keep seeing what's going on during execution
R. Use the tee program (also available on Windows)
http://en.wikipedia.org/wiki/Tee_%28command%29
imapsync ... 2>&1 | tee log.txt
=======================================================================
Q. I run multiple imapsync applications at the same time then get a
warning "imapsync.pid already exists, overwriting it".
Is this a potential problem when trying to sync multiple
IMAP account in parallel?
R1. No issue with the file imapsync.pid if you don't use its content
by yourself.
This file can help you to manage multiple runs by sending signals
to the processes (sigterm or sigkill) using their PID.
Each run can have its own pid file with --pidfile option.
The file imapsync.pid contains the PID of the imapsync process.
This file is removed at the end of a normal run.
You can safely ignore the warning if you don't use imapsync.pid file.
=======================================================================
Q. Couldn't create [INBOX.Ops/foo/bar]: NO Invalid mailbox name:
INBOX.Ops/foo/bar
Let begin by an explanation.
Example:
sep1 = /
sep2 = .
imapsync reverts each separator automaticaly.
a) All / character coming from host1 are converted to . (convert the separator)
b) All . character coming from host1 are converted to / (to avoid
intermediate unwanted folder creation).
So
INBOX/Ops.foo.bar (Ops.foo.bar is just one folder name) will be translated to
INBOX.Ops/foo/bar
Sometimes the sep1 character is not valid on host2 (character "/" usualy)
R. Try :
--regextrans2 "s,/,X,g"
It'll convert / character to X
Choose X as you wish: _ or SEP or
any string (including the empty string).
=======================================================================
Q. The option --subscribe does not seem to work
R1. Use it with --subscribed
R2. There is also the --subscribe_all option that subscribe
to all folders on host2.
=======================================================================
Q. Does imapsync retain the \Answered and $Forwarded flags?
R. It depends on the destination server.
a) If the destination server honors the "PERMAENTFLAGS \*"
directive (meaning it accepts any flag) or no PERMAENTFLAGS at all
then imapsync synchronises all flags except the \Recent flag
(RFC 3501 says about \Recent flag "This flag can not be
altered by the client.").
b) If the destination server honors the "PERMAENTFLAGS without the
special "\*" then imapsync synchronises only the flags listed
in PERMANENTFLAGS.
Some imap servers have problems with flags not beginning with
the backslash character \
(see next question to find a solution to this issue)
=======================================================================
Q. How to convert flags?
R. use --regexflag
For example to convert flag IMPORTANT to flag CANWAIT
imapsync ... --regexflag "s/IMPORTANT/CANWAIT/g" --debugflags
option --debugflags is usefull to see in details what imapsync
does with flags.
=======================================================================
Q. How to convert flags with $ to \ character?
R. $ and \ are special characters we have to "escape" them.
For example to convert flag $label1 to \label1
imapsync ... --regexflag 's/\$label1/\\label1/g' --debugflags
=======================================================================
Q. I need to keep only a defind list of flags, how can I do?
The destination imap server complains about bad flags (Exchange).
R1. Recent imapsync deals with this issue by filter with PERMANENTFLAGS
automatically.
R2. For example if you want to keep only the following flags
\Seen \Answered \Flagged \Deleted \Draft
then use these magic --regexflag options (thanks to Phil):
--regexflag 's/.*?(?:(\\(?:Answered|Flagged|Deleted|Seen|Draft)\s?)|$)/defined($1)?$1:q()/eg'
Analysis is left to the reader.
This one is longer and may be use with old perl (no /e regex extension):
--regexflag 's/(.*)/$1 jrdH8u/' \
--regexflag 's/.*?(\\Seen|\\Answered|\\Flagged|\\Deleted|\\Draft|jrdH8u)/$1 /g' \
--regexflag 's/(\\Seen|\\Answered|\\Flagged|\\Deleted|\\Draft|jrdH8u) (?!(\\Seen|\\Answered|\\Flagged|\\Deleted|\\Draft|jrdH8u)).*/$1 /g' \
--regexflag 's/jrdH8u *//'
======================================================================
Q. imapsync fails with the following error:
flags from : [\Seen NonJunk]["10-Aug-2006 13:00:30 -0400"]
Error trying to append string: 58 NO APPEND Invalid flag list
R. For some servers, flags have to begin with a \ character.
The flag "NonJunk" may be a invalid flag for your server
so use for example:
imapsync ... --regexflag "s/NonJunk//g"
Remark (thanks to Arnt Gulbrandsen):
IMAP system flags have to begin with \ character.
Any other flag must begin with another character.
System flags are just flags defined by an RFC instead of by users.
Conclusion, some imap server coders don't read the RFCs (so do I).
Recent imapsync deals with this issue by filter with PERMANENTFLAGS
automatically.
=======================================================================
Q. Flags are not well synchonized. Is it a bug?
R. It happens with some servers on the first sync.
Also, it was a bug from revision 1.200 to revision 1.207
Solution: run imapsync a second time. imapsync synchronizes flags
on each run.
=======================================================================
Q. On Unix, some passwords contain * and " characters. Login fails.
R. Use a backslash to escape the characters:
imapsync ... --password1 \"password\"
It works for the star * character,
I don't know if it works for the " character.
=======================================================================
Q. On Windows, some passwords contain $ characters. Login fails.
R1. Enclose passwords between ""
imapsync ... --password1 "zzz$zz$$z"
R2. Prefix each $ character with a ^ since ^ is the escape character
on Windows
imapsync ... --password1 zzz^$zz^$^$z
For a password that is exactly the 8 characters string $%&<>|^"
you have to enter
imapsync ... --password1 "$%%&<>|^"^"
=======================================================================
Q. On Windows, some passwords begin with an equal = character.
Login fails. What can I do?
R. Use twice equals == characters instead; For example, if =secret
is the password then use:
imapsync ... --password1 ==secret
or even
imapsync ... --password1 "==secret"
=======================================================================
Q. With huge account (many messages) when it comes to reading the
destination server it comes out this error:
"To Folder [INBOX.foobar] Not connected"
What can I do?
R. May be spending too much time on the source server, the connection
timed out on the destination server.
Try options --nofoldersizes
=======================================================================
Q. imapsync failed with a "word too long" error from the imap server,
What can I do?
R. Use imapsync release 1.172 or at least 1.166 with options
--split1 500 --split2 500
or a old old imapsync (before 1.94)
=======================================================================
Q. Does imapsync support IMAP over TLS (IMAPS)?
R. Yes natively since release 1.161.
still, 2 ways, at least :
a) Use --ssl1 and/or --ssl2 options
--ssl1 tells imapsync to use ssl on host1
--ssl2 tells imapsync to use ssl on host2
b) Use stunnel
http://www.stunnel.org/
Assuming there is an imaps (993) server on imap.foo.org,
on your localhost machine (or bar machine) run :
stunnel -c -d imap -r imap.foo.org:imaps
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.
=======================================================================
Q: How to have an imaps server?
R.
a) Install one
b) or use stunnel :
Assuming there is an imap (143) server on localhost
stunnel -d 993 -r 143 -f
c) or use stunnel on inetd
imaps stream tcp nowait cyrus /usr/sbin/stunnel -s cyrus -p /etc/ssl/certs/imapd.pem -r localhost:imap2
=======================================================================
Q: I'm trying to use imapsync on win32 for gmail and it requires ssl.
Imapsync appears to require IO::Socket::SSL. What can I do?
R1: use standalone imapsync.exe, it contains IO::Socket::SSL
Perl module embeded.
R2: IO::Socket::SSLio-socket-ssl is available on Win32
with Strawberry Perl.
=======================================================================
Q: Multiple copies when I run imapsync twice ore more.
R1. You can use option --useuid, imapsync then won't use header lines to
compare messages in folders. Keep in ming it uses a local cache.
imapsync ... --useuid
R2. Multiple copies of the emails on the destination server. Some IMAP
servers (Domino for example) add some headers for each message
transfered. The message is transfered again and again each time you
run imapsync. This is bad of course. The explanation is that imapsync
considers the message is not the same since headers have changed (one
line added) and size too (the header part).
You can look at the headers found by imapsync by using the --debug
option (and search for the message on both part), Header lines from
the source server begin with a "FH:" prefix, Header lines from the
destination server begin with a "TH:" prefix. Since --debug is very
verbose I suggest to isolate a email in a specific folder in case you
want to forward me the output.
The way to avoid this problem is by using options --skipheader and
--skipsize, like this (avoid headers beginning whith the string "X-"):
imapsync ... --skipheader '^X-' --skipsize
To skip several headers you can use --skipheader one time
imapsync ... --skipheader '^X-|^Status|^Bcc'
If you think you have too many header to avoid just use
imapsync ... --useheader 'Message-ID' --skipsize
Remark. (Trick found by Tomasz Kaczmarski)
Option --useheader 'Message-ID' asks the server to send only header
lines begining with 'Message-ID'. Some (buggy) servers send the whole
header (all lines) instead of the 'Message-ID' line. In that case, a
trick to keep the --useheader filtering behavior is to use
--skipheader with a negative lookahead pattern :
imapsync ... --skipheader '^(?!Message-ID)' --skipsize
Read it as "skip every header except Message-ID".
======================================================================
Q. I am transferring mails from one IMAP server to another. I am using
an SSL connection. Transferring huge mails (>10MB) takes ages.
R. try to transfer the mails without SSL connection. SSL code outside
imapsync uses a memory buffer, which gets increased upon reading of
mails by 4096 bytes. This creates a huge load on the host imapsync
runs on by copying the memory buffers for every 4096 byte step.
This does not occur without SSL.
(Written by Stefan Schmidt)
======================================================================
Q. What are --subscribe and --subscribed for, and how can they be used?
R. In the IMAP protocol each user can subscribe to one or more folders.
Then he can configure its email software to just see his subscribed
folders list. That's an IMAP feature.
Knowing that, the imapsync help says:
imapsync --help
...
--subscribed : transfers subscribed folders.
--subscribe : subscribe to the folders transferred on the
host2 that are subscribed on host1.
--subscribe_all : subscribe to the folders transferred on the
host2 even if they are not subscribed on host1.
======================================================================
Q. I want to exclude a folder hierarchy like "public"
R. Use:
--exclude '^public\.'
or maybe
--exclude '^"public\.'
In the example given the character "." is the folder separator, you
can ommit it. Just take the string as it appears on the imapsync
output line :
From folders list : [INBOX] [public.dreams] [etc.]
======================================================================
Q. I want to exclude only INBOX
R. Use:
imapsync ... --exclude '^INBOX$'
A good way to see what will be done is to first use:
imapsync ... --exclude '^INBOX$' --justfolders --nofoldersizes --dry
======================================================================
Q. I want the --folder 'MyFolder' option be recursive.
Two solutions:
R1. Use
--folderrec 'MyFolder'
R2. Use --include '^MyFolder'
Then the folder "MyFolder" and all its subfolders will be handled
and only them.
======================================================================
Q. How to migrate from or to Exchange 2003 with an admin/authuser
account?
R. Thomas Edgar wrote the following
In case you can glean something from this snippet which allowed us
to migrate from Exchange 2003 t0 Cyrus Imap 2.4 (you would reverse
the flow to go the other way):
imapsync --dry --host1 ExchangeServer.mycompany.com \
--user1 [email protected] --authuser1 ExchangeAdminAccount \
--proxyauth1 --password1 '$pass_with_dollars$' \
--host2 cyrusimapbackend.mycompany.com \
--user2 [email protected] \
--authuser2 CyrusAdminAccount --proxyauth2
We also needed to:
- Ensure the Exchange Admin Acct had IMAP4 enabled in it's
profile (it initially didn't!)
- Ensure the Some.User Exchange Acct had IMAP4 enabled
in it's profile (it initially didn't!)
- Add the CyrusAdminAccount to admins line in /etc/imapd.conf
- Give CyrusAdminAccount lrswipkxtecda to the Cyrus Imap account
being migrated to (- or in your case, from)
In case you are not aware:
- It will prompt for a password if you don't supply it
- the domain part of the fully-qualified email could be
omitted in our case
- Use --debugimap when testing initial connectivity, if necessary
======================================================================
Q. How to migrate from or to Exchange 2007/2010 with an
admin/authuser account?
R. The tricks comes from Michele Marcionelli and Benjamin Priestman:
This doesn't work:
imapsync ... --user2 user2 --authuser2 admin2 --password2 adminpassword2 ...
This might works:
imapsync ... --user2 'domain\admin2\user2' --password2 adminpassword2 ...
or
imapsync ... --user2 'admin2@domain\user2' --password2 adminpassword2 ...
where "domain" is set be the user's UPN in Active Directory
or the NETBIOS or DNS name of the domain.
The exact format might vary depending on local configuration and you
should experiment with the different formats.
======================================================================
Q. How to migrate from uw-imap with an admin/authuser account?
R. Use
--user1="user*admin_user" --password1 "admin_user_password"
======================================================================
Q. How to migrate from cyrus with an admin account?
R. Use
--authuser1 admin_user ----password1 admin_user_password \
--user1 foo_user --ssl1
In this case, --authmech1 PLAIN will be used by default since it
is the only way to go for now. So don't use --authmech1 SOMETHING
with --authuser1 admin_user, it will not work.
Same behavior with the --authuser2 option.
Do not forget the option --ssl1 since PLAIN auth is only
supported with ssl encryption most of the time. But it can
work without --ssl1 if PLAIN is permitted in normal use.
Here is an example:
imapsync \
--host1 server1 \
--user1 joe \
--authuser1 AdminAccount \
--password1 AdminAccountPassword \
--ssl1 \
--host2 server2 \
--user2 joe \
--password2 joespassonserver2 \
--exclude '^user\.'
======================================================================
Q: How to migrate from Sun Java Enterprise System / Sun One / iPlanet /
Netscape servers with an admin account?
R: Those imap servers don't allow the typical use of --authuser1 to use an
administrative account. They expect the use of an IMAP command called
proxyauth that is issued after login in as an administrative account.
For example, consider the administrative account 'administrator' and your
real user 'real_user'. The IMAP sequence would be:
OK [CAPABILITY IMAP4 IMAP4rev1 ACL QUOTA LITERAL+ NAMESPACE UIDPLUS
CHILDREN BINARY UNSELECT LANGUAGE STARTTLS XSENDER X-NETSCAPE XSERVERINFO
AUTH=PLAIN] imap.server IMAP4 service (Sun Java(tm) System Messaging
Server ...))
1 LOGIN administrator password
1 OK User logged in
2 PROXYAUTH real_user
2 OK Completed
In imapsync, you can achieve this by using the following options:
--host1 source.imap.server \
--user1 real_user \
--authuser1 administrator \
--proxyauth1 \
--passfile admin.txt
======================================================================
Q. Is there anyway of making imapsync purge the destination folder
when the source folder is deleted?
R. No, that's too dangerous. May be coded in future release.
But if the source folder is empty (not deleted) and options --delete2
--expunge2 are used then the destination folder will be empty.
======================================================================
Q. Is it possible to synchronize all messages from one server to
another without recreating the folder structure and the target server.
R. Yes.
For example, to synchronize all messages in all forders on host1
to folder INBOX only on host2:
1) First try (safe mode):
imapsync \
...
--regextrans2 's/(.*)/INBOX/' \
--dry --justfolders
2) See if the output says everything you want imapsync to do,
--dry option is safe and does nothing real.
3) Remove --dry
Check the imap folder tree on the target side, you should
only have one: the classical INBOX.
4) Remove --justfolders
======================================================================
Q. I have moved from Braunschweig to Graz, so I would like to have my
whole Braunschweig mail sorted into a subfolder INBOX.Braunschweig
of my new mail account.
R.
1) First try (safe mode):
imapsync \
...
--regextrans2 's/INBOX(.*)/INBOX.Braunschweig$1/' \
--dry --justfolders
2) See if the output says everything you want imapsync to do,
--dry option is safe and does nothing real.
3) Remove --dry
Check the imap folder tree on the target side
4) Remove --justfolders
=======================================================================
Q. Give examples about --regextrans2
R. --regextrans2 is used to transform folder names
Remember that --regextrans2 applies after the default
inversion prefix1 <-> prefix2 and sep1 <-> sep2
Examples:
0) First try with --dry --justfolders options since imapsync shows the
transformations it will do without really doing them. Then when
happy with the output remove the --dry --justfolders options.
1) To remove INBOX. in the name of destination folders:
--regextrans2 's/^INBOX\.(.+)/$1/'
2) To sync a complete account in a subfolder called FOO:
a) Seperator is dot character "." and "INBOX" prefixes every folder
--regextrans2 's/^INBOX(.*)/INBOX.FOO$1/'
or:
b) Seperator is slash character "/" and there is no prefix
--regextrans2 's#(.*)#FOO/$1#'
or:
c) Any separator, any prefix solution, FOO is the subfolder:
It is a complicated line because every case is taken into account.
Type it in one line (or with the \ at the end of first line on Unix shells.
--regextrans2 's,${h2_prefix}(.*),${h2_prefix}FOO${h2_sep}$1,' \
--regextrans2 's,^INBOX$,${h2_prefix}FOO{h2_sep}INBOX,'
3) to substitute all characters dot "." by underscores "_"
--regextrans2 's/\./_/g'
4) to change folder names like this:
[mail/Sent Items] -> [Sent]
[mail/Test] -> [INBOX/Test]
[mail/Test2] -> [INBOX/Test2]
--regextrans2 's#^mail/Sent Items$#Sent#' \
--regextrans2 's#^mail/#INBOX/#'
=======================================================================
Q. I would like to move emails from InBox to a sub-folder called,
say "2010-INBOX" based on the date (Like all emails received in the
Year 2010 should be moved to the folder called "2010-INBOX").
R. 2 ways :
a) Manually:
------------
1) You create a folder INBOX.2010-INBOX
2) Mostly every email software allow sorting by date. In INBOX, you
select from 1 january to 31 december 2010 messages with the shift key.
(in mutt, use ~d)
3) Cut/paste in INBOX.2010-INBOX
b) With imapsync:
-----------------
imapsync ... \
--search 'SENTSINCE 1-Jan-2010 SENTBEFORE 31-Dec-2010'
--regextrans2 's/^INBOX$/INBOX.2010-INBOX/' \
--folder INBOX
=======================================================================
Q. I want to play with headers line and --regexmess but I want to leave
the body as is
R. The header/body separation is a blank line so an example:
--regexmess 's{\A(.*?(?! ^$))^Date:(.*?)$}{$1Date:$2\nX-Date:$2}gxms'
Will replace (HeaderBegin and HeaderEnd are not part of the header)
HeaderBegin
Message-ID: <[email protected]>
Date: Fri, 20 Feb 2009 19:35:44 +0100
From: Gilles LAMIRAL <[email protected]>
HeaderEnd
by
HeaderBegin
Message-ID: <[email protected]>
Date: Fri, 20 Feb 2009 19:35:44 +0100
X-Date: Fri, 20 Feb 2009 19:35:44 +0100
From: Gilles LAMIRAL <[email protected]>
HeaderEnd
This example just add an header line "X-Date:" based on "Date:" line.
=======================================================================
Q. My imap server does not accept a message and warns
"Invalid header". What is the problem?
R. You fall in the classical mbox versus Maildir/ format
problem. May be you use a misconfigured procmail rule.
A header beginning like the following one is in the mbox
format, header line 1 has no colon behind "From", header
lines 2 through N do have a colon :
From [email protected] Sat Jun 22 01:10:21 2002
Return-Path: <[email protected]>
Received: ...
Any Maildir/ configured imap server may refuse this message since its
header is invalid. The first "From " line is not valid. It lacks a
colon character ":". To solve this issue you have several solutions