IMAPSYNC(1) User Contributed Perl Documentation IMAPSYNC(1) (NAME) imapsync - IMAP (VERSION) Imapsync $Revision: 2.314 $ . (USAGE) IMAP "test1" "test1.lamiral.info" "secret1" IMAP "test2" "test2.lamiral.info" "secret2" : imapsync \ - -ser1 test1 -assword1 secret1 \ - -ser2 test2 -assword2 secret2 (DESCRIPTION) (mailboxes) IMAP . imapsync (incremental) (recursive) . . (\Seen \Answered \Flagged ) . imapsync . . . -elete2 . imapsync (headers) . "Message-Id:" "Received:" . -seheader . -seheader "Message-Id" . . -0resyncflags . : IMAP \Deleted . IMAP EXPUNGE UIDEXPUNGE . . imapsync . Ctrl-c . Ctrl-c imapsync IMAP . imapsync : Exiting with return value 0 (EX_OK: successful termination) 0/50 nb_errors/max_errors PID 20332 Removing pidfile /home/gilles/tmp/imapsync.pid Log file is LOG_imapsync/2023_08_21_11_51_27_651_test1_test2.txt ( to change it, use -r use -0log to turn off logging ) ( ) ( kill -9 ). . . : The sync looks good, all 1745 identified messages in host1 are on host2. There is no unidentified message on host1. Detected 0 errors imapsync . . . IMAP imapsync . imapsync IMAP . imapsync . IMAP . Gmail imapsync . B A A B . A B . -elete2 . -elete2 B host2 A host1 . host2 host1 -elete2folders . -elete2foldersonly -elete2foldersbutnot . INBOX IMAP imapsync . . . . -elete1 . -elete1 -\xpunge1 host1 . IMAP \Deleted . (Expunge) \Deleted . . -elete1emptyfolders . imapsync IMAP . offlineimap ( John Goerzen) mbsync ( Michael R. Elkins) . (OPTIONS) usage: imapsync [options] (credentials) . IMAP . . : str (string) int (integer) flo (float) reg (regular expression) cmd (command) -ry : imapsync -ry . (OPTIONS/credentials) - IP . -ort1 int : host1. imap/143 imaps/993 . SSL/TLS host1 -l1 . -ser1 str : host1. -assword1 str : user1. - -ort2 int : host2. imap/143 imaps/993 . SSL/TLS host2 -l2 . -ser2 str : host2. -assword2 str : user2. -owpasswords : "MASKED" . . ! -assfile1 str : user1. . ( -assword1 ) . -assfile2 str : user2. IMAPSYNC_PASSWORD1 IMAPSYNC_PASSWORD2 . user1 -assword1 -assfile1 $IMAPSYNC_PASSWORD1 imapsync . user2 . (OPTIONS/encryption) -0ssl1 : IMAP SSL/TLS host1 . -l1 : IMAP SSL/TLS host1 . imaps . 993 . . -0ssl2 : IMAP SSL/TLS host2 . -l2 : IMAP SSL/TLS host2 . -l1 host2. -0tls1 : SSL/TLS "STARTTLS" host1 . -ls1 : SSL/TLS "STARTTLS" host1 . 143 . imaps . -0tls2 : SSL/TLS "STARTTLS" host2 . -ls2 : SSL/TLS STARTTLS host2 . -ls1 host2. -ebugssl int : SSL/TLS 0 4. -largs1 str : SSL/TLS host1. : -largs1 SSL_verify_mode=1 -largs1 SSL_version=TLSv1_3 new() IO::Socket::SSL: http://search.cpan.org/perldoc?IO::Socket::SSL#Description_Of_Methods -largs2 str : SSL/TLS host2. -largs1 host2. (OPTIONS/authentication) -uthmech1 str : host1: PLAIN LOGIN CRAM-MD5 ( ). -uthmech2 str : host2 ( -uthmech1). -uthuser1 str : host1 ( ). -uthmech1 SOMETHING -uthuser1 . -uthuser2 str : host2 ( ). -roxyauth1 : proxyauth host1. -uthuser1 . Sun/iPlanet/Netscape . -roxyauth2 : proxyauth host2. -uthuser2 . -uthmd51 : MD5 host1. -uthmd52 : MD5 host2. -omain1 str : host1 ( NTLM). -omain2 str : host2 ( NTLM). -hccesstoken1 str : OAUTH2 host1. -ser1 XOAUTH2 . . . -hccesstoken2 str : -hccesstoken1 host2. - - -outh. "cmd arg1 arg2 ..." . - (OPTIONS/folders) -lder str : . -lder str : . -lderrec str : . -lderrec str : . -lderfirst str : . : -lderfirst "INBOX" -lderfirst str : . -lderlast str : . -lderlast "[Gmail]/All Mail" -lderlast str : . -0mixfolders : host1 host2 ( Exchange). . : "Sent" "SENT" "sent" host1 "Sent" host2 . -ipemptyfolders : host1 host2 . -include reg : . -include reg : . -include -\xclude include . -\xclude reg : . : -\xclude 'fold1|fold2|f3' fold1 fold2 f3 . -\xclude reg : . -utomap : "Sent" "Junk" "Drafts" "All" "Archive" "Flagged". -f2 str1=str2 : str1 str2. -f2 -utomap -egextrans2 . -f2 . str1 str2 . -egextrans2 . -bfolder2 str : host1 host2 str. -egextrans2 . -ebug . -bfolder1 str : host1 str host2. -bfolder2 . /: -bfolder2 str str host2. -bfolder1 str str host1/host2 user1/user2. -bscribed : (subscribed). -bscribe : host2 host1 . . -bscribeall : host2 host1 . -refix1 str : str "INBOX." "INBOX/" "". host1 NAMESPACE imapsync . . -refix2 str : host2 ( -refix1). -p1 str : host1. . imapsync NAMESPACE ( / . \\ \). -p2 str : host2 ( -p1). -egextrans2 reg : . -egextrans2 reg : . -ry -justfolders . -ry -justfolders . . : https://imapsync.lamiral.info/FAQ.d/FAQ.Folders_Mapping.txt (OPTIONS/folders sizes) -0foldersizes : . . -0foldersizesatend: . . -justfoldersizes : . (OPTIONS/tmp) -mpdir str : . . HOME/tmp$ . 2.250 tmp/ ( CVE-2023-34204): https://github.com/imapsync/imapsync/issues/399 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-34204 -idfile str : (PID) . . imapsync.pid tmpdir . -idfilelocking : pidfile . . (OPTIONS/log) -0log : ( ). - - - : LOG_imapsync/2019_12_22_23_57_59_532_user1_user2.txt : 2019_12_22_23_57_59_532 : YYYY_MM_DD_HH_MM_SS_mmm : ______ user1 user2 -ser1 -ser2 . (OPTIONS/messages) -ipmess reg : . : 'm/[\x80-\xff]/' . -ipmess -egexmess . -ipmess reg : . -ipcrossduplicates : . Gmail Gmail . -ail1 -0skipcrossduplicates . -ebugcrossduplicates : ( UID) -ipcrossduplicates . -ipemess cmd : cmd . -ipemess cmd : . -ipemess (STDOUT) (STDIN) . : "cat message | cmd1 | cmd2 | cmd3" -isarmreadreceipts : ( Exchange host2). -egexmess reg : . : 's/\000/ /g' null . -egexmess reg : . -runcmess int : int . . . -0dry1 : host1 imapsync -ry . -ry -0dry1 -ipemess -egexmess . (OPTIONS/labels) Gmail IMAP . imapsync X-GM-LABELS host2 . -nclabels : Gmail host2. -ail1 -ail2 -0synclabels . -esynclabels : Gmail host2 . -ail1 -ail2 -0resynclabels . Gmail : https://imapsync.lamiral.info/FAQ.d/FAQ.Gmail.txt (OPTIONS/flags) : https://imapsync.lamiral.info/FAQ.d/FAQ.Flags.txt -egexflag reg : . : 's/"Junk"//g' "Junk". -egexflag reg : . -esyncflags : . . -0resyncflags : . host2 . -lterbuggyflags : "BAD Invalid system flag" "NO APPEND Invalid flag list" . (OPTIONS/deletions) -elete1 : host1 . IMAP \Deleted EXPUNGE . -0expungeaftereach . -\xpunge1 : (expunge) host1 . \Deleted . -elete1 . -0expunge1 : host1 . -elete1emptyfolders : host1 INBOX. -elete1 host1 . -elete2 : host2 host1 . . -elete2 -idexpunge2 . -elete2duplicates : host2 host2 . -seuid . : -elete2 . -elete2folders : host2 host1 . ( -\xclude -include ). : -elete2folders -ry -justfolders -0foldersizes -elete2foldersonly reg : reg. : -elete2foldersonly "/^Junk$|^INBOX.Junk$/" -elete2folders . -elete2foldersbutnot reg : rex. : -elete2foldersbutnot "/Tasks$|Contacts$|Foo$/" -elete2folders . -0expunge2 : host2 . -0uidexpunge2 : uidexpunge host2 host1 . (OPTIONS/dates) : https://imapsync.lamiral.info/FAQ.d/FAQ.Dates.txt -ncinternaldates : host2 host1. . ( mtime ). -idatefromheader : host2 "Date:". (OPTIONS/message selection) -xsize int : ( ) int . -nsize int : ( ) int . -xage int : int . () . -nage . -nage int : int . . ( + ): past|----xage+++++++++++++++>now past|+++++++++++++++minage---->now past|----xage+++++minage---->now () past|++++minage-----xage++++>now () -arch str : IMAP SEARCH . . : https://imapsync.lamiral.info/FAQ.d/FAQ.Messages_Selection.txt -arch1 str : -arch host1. -arch2 str : -arch host2. -arch CRIT -arch1 CRIT -arch2 CRIT . -0abletosearch : FETCH "Date:" -nage -xage. . -0abletosearch1 -0abletosearch2 . -0abletosearch1 : -0abletosearch host1. -0abletosearch2 : -0abletosearch host2. -xlinelength int : int . RFC 2822 . -seheader str : . : "Message-Id" "Received" "Date". -seheader str : . -ncduplicates : ( ). -secache : () ( ). -0usecache : . : -seuid -0usecache . -seuid : UID . -secache -0usecache . (OPTIONS/miscellaneous) -ncacls : (ACLs). ACL IMAP ACL . -0syncacls : ACL (). -ddheader : "Message-Id" "Message-Id: 12345@imapsync" UID host1 . "Sent" "Draft" . (OPTIONS/debugging) -ebug : . -ebugfolders : . -ebugcontent : ( ). -ebugflags : . -ebugimap1 : IMAP host1 ( ). -ebugimap2 : IMAP host2 ( ). -ebugimap : IMAP host1 host2 ( ). -ebugmemory : . -\rrorsmax int : int . . -ests : (non-regression tests). 0 . -estslive : test1.lamiral.info. . -estslive6 : tests1ipv6.lamiral.info. IPv6 . (OPTIONS/specific) -ail1 : - -ail2 : - -ice1 : - -ice2 : - -\xchange1 : Exchange ( FAQ.Exchange.txt). -\xchange2 : Exchange ( FAQ.Exchange.txt). -omino1 : Domino ( FAQ.Domino.txt). -omino2 : Domino ( FAQ.Domino.txt). (OPTIONS/behavior) -imeout1 flo : (timeout) host1. . -imeout2 flo : host2. . : CGI imapsync IMAP . INSTALL.OnlineUI.txt "Timeout" . -epalive1 : https://metacpan.org/pod/Mail::IMAPClient#Keepalive . SO_KEEPALIVE host1 . 2.169 . -0keepalive1 . -epalive2 : -epalive1 host2. -0keepalive2 . -xmessagespersecond flo : . -xbytespersecond int : . -xbytesafter int : -xbytespersecond int . -xsleep flo : int . -xsleep 2. -bort : . pidfile . -\xitwhenover int : int . - -0releasecheck : imapsync. -eleasecheck : imapsync. HTTP GET : http://imapsync.lamiral.info/prj/imapsync/VERSION -\mailreport1 : INBOX host1. -\mailreport2 : INBOX host2. -0emailreport1 : INBOX host1. -0emailreport2 : INBOX host2. -0id : / IMAP "ID" IMAP. -justconnect : . - "imapsync -st" . -justlogin : host1 host2 . -justfolders : ( ). - : IMAP "test1" "test1.lamiral.info" IMAP "test2" "test2.lamiral.info" "secret1" test1 "secret2" test2: imapsync \ - -ser1 test1 -assword1 secret1 \ - -ser2 test2 -assword2 secret2 (SECURITY) -assword1 -assfile1 . -assword1 'ps auxwwww' . ( IMAPSYNC_PASSWORD1) 'ps auxwwwwe' . (600 rw-------) . imapsync SSL/TLS . << >> imaps ( 993) IMAP imapsync SSL/TLS . imaps imapsync ( ) 143 . (CAPABILITY) STARTTLS . STARTTLS imapsync IMAP STARTTLS SSL/TLS . SSL/TLS imapsync (clear-text) . . SSL/TLS -l1 -l2 -ls1 -ls2 . imapsync . FAQ.Security.txt FAQ.d/ : https://imapsync.lamiral.info/FAQ.d/FAQ.Security.txt (EXIT STATUS) imapsync 0 . . . ( 0 255) . Bourne Shell imapsync "$?" . : EX_OK => 0 ; #/* */ EX_USAGE => 64 ; #/* */ EX_NOINPUT => 66 ; #/* */ EX_UNAVAILABLE => 69 ; #/* */ EX_SOFTWARE => 70 ; #/* */ EXIT_CATCH_ALL => 1 ; # EXIT_BY_SIGNAL => 6 ; # (128+n) EXIT_BY_FILE => 7 ; EXIT_PID_FILE_ERROR => 8 ; EXIT_CONNECTION_FAILURE => 10 ; EXIT_TLS_FAILURE => 12 ; EXIT_AUTHENTICATION_FAILURE => 16 ; EXIT_SUBFOLDER1_NO_EXISTS => 21 ; EXIT_WITH_ERRORS => 111 ; EXIT_WITH_ERRORS_MAX => 112 ; EXIT_OVERQUOTA => 113 ; EXIT_ERR_APPEND => 114 ; EXIT_ERR_FETCH => 115 ; EXIT_ERR_CREATE => 116 ; EXIT_ERR_SELECT => 117 ; EXIT_TRANSFER_EXCEEDED => 118 ; EXIT_ERR_APPEND_VIRUS => 119 ; EXIT_ERR_FLAGS => 120 ; EXIT_ERR_SEARCH => 121 ; EXIT_TESTS_FAILED => 254 ; # API Test::More EXIT_CONNECTION_FAILURE_HOST1 => 101 ; EXIT_CONNECTION_FAILURE_HOST2 => 102 ; EXIT_AUTHENTICATION_FAILURE_USER1 => 161 ; EXIT_AUTHENTICATION_FAILURE_USER2 => 162 ; (LICENSE AND COPYRIGHT) imapsync ( ) NOLIMIT Public License ( NLPL ) . LICENSE : "No limits to do anything with this work and this license." : "No limits to do anything with this work and this license." : https://imapsync.lamiral.info/LICENSE (AUTHOR) Gilles LAMIRAL . . Gilles LAMIRAL . imapsync . (BUGS AND LIMITATIONS) : https://imapsync.lamiral.info/FAQ.d/FAQ.Reporting_Bugs.txt IMAP (IMAP SERVERS supported) : https://imapsync.lamiral.info/S/imapservers.shtml (HUGE MIGRATION) (shell script) . file.txt ( ) . ';' . file.txt : 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 ... : { while IFS=';' read u1 p1 u2 p2; do imapsync -rg -ser1 "$u1" -assword1 "$p1" \ -rg -ser2 "$u2" -assword2 "$p2" ... done ; } < file.txt (batch) : FOR /F "tokens=1,2,3,4 delims=; eol=#" %%G IN (file.txt) DO imapsync ^ -rg -ser1 %%G -assword1 %%H ^ -rg -ser2 %%I -assword2 %%J ... ... imapsync . ! : https://imapsync.lamiral.info/examples (INSTALL) Imapsync Perl . Imapsync (2000 XP Vista Seven Eight Ten Eleven 2000 2003 2008 R2 2012 R2 2016) imapsync.exe . : https://imapsync.lamiral.info/README_Windows.txt Imapsync macOS (OS X) imapsync_bin_Darwin : https://imapsync.lamiral.info/INSTALL.d/INSTALL.Darwin.txt imapsync : https://imapsync.lamiral.info imapsync-2.xxx.tgz 2.xxx . tar ( ): tar xzvf imapsync-2.xxx.tgz imapsync-x.xx INSTALL . https://imapsync.lamiral.info/#install INSTALL https://imapsync.lamiral.info/INSTALL.d/INSTALL.ANY.txt . : https://imapsync.lamiral.info/INSTALL.d (CONFIGURATION) imapsync . (HACKING) imapsync NOLIMIT . (SIMILAR SOFTWARE) : https://imapsync.lamiral.info/S/external.shtml (HISTORY) imapsync BaSystemes IMAP ISDN . . imapsync rsync . imapsync (patch) copy_folder.pl . copy_folder.pl Mail-IMAPClient-2.1.3 ( examples/ Mail-IMAPClient) . copy_folder.pl imapsync . perl v5.42.0 2025-09-28 IMAPSYNC(1)