Coder Social home page Coder Social logo

imapsync / imapsync Goto Github PK

View Code? Open in Web Editor NEW
3.2K 89.0 447.0 15.04 MB

Imapsync is an IMAP transfers tool. The purpose of imapsync is to migrate IMAP accounts or to backup IMAP accounts. IMAP is one of the three current standard protocols to access mailboxes, the two others are POP3 and HTTP with webmails, webmails are often tied to an IMAP server. Upstream website is

Home Page: http://imapsync.lamiral.info

License: Other

Perl 56.29% Shell 22.69% JavaScript 8.00% CSS 0.40% Makefile 2.93% HTML 8.84% Python 0.85%
imap imaps imapsync mailbox emails perl migration

imapsync's Introduction

NAME

    imapsync - Email IMAP tool for syncing, copying, migrating and archiving
    email mailboxes between two imap servers, one way, and without
    duplicates.

VERSION

    This documentation refers to Imapsync $Revision: 2.229 $

USAGE

     To synchronize the source imap account
       "test1" on server "test1.lamiral.info" with password "secret1"
     to the destination imap account
       "test2" on server "test2.lamiral.info" with password "secret2"
     do:

      imapsync \
       --host1 test1.lamiral.info --user1 test1 --password1 secret1 \
       --host2 test2.lamiral.info --user2 test2 --password2 secret2

DESCRIPTION

    We sometimes need to transfer mailboxes from one imap server to one
    another.

    Imapsync command is a tool allowing incremental and recursive imap
    transfers from one mailbox to another. If you don't understand the
    previous sentence, it's normal, it's pedantic computer-oriented jargon.

    All folders are transferred, recursively, meaning the whole folder
    hierarchy is taken, all messages in them, and all message flags (\Seen
    \Answered \Flagged etc.) are synced too.

    Imapsync reduces the amount of data transferred by not transferring a
    given message if it already resides on the destination side. Messages
    that are on the destination side but not on the source side stay as they
    are. See the --delete2 option to have strict sync and delete them.

    How does imapsync know a message is already on both sides? Same specific
    headers and the transfer is done only once. By default, the
    identification headers are "Message-Id:" and "Received:" lines but this
    choice can be changed with the --useheader option, most often a
    duplicate problem is solved by using --useheader "Message-Id"

    All flags are preserved, unread messages will stay unread, read ones
    will stay read, deleted will stay deleted. In the IMAP protocol, a
    deleted message is not deleted, it is marked \Deleted and can be
    undeleted. Real destruction comes with the EXPUNGE or UIDEXPUNGE IMAP
    commands.

    You can abort the transfer at any time and restart it later, imapsync
    works well with bad connections and interruptions, by design. On a
    terminal hit Ctr-c twice within two seconds to abort the program. Hit
    Ctr-c just once makes imapsync reconnect to both imap servers.

    How do you know the sync is finished and well done? When imapsync ends
    by itself it mentions it with lines like those:

      Exiting with return value 0 (EX_OK: successful termination) 0/50 nb_errors/max_errors PID 301
      Removing pidfile /tmp/imapsync.pid
      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 )

    If you don't have those lines it means that either the sync process is
    still running (or eventually hanging indefinitely) or that it ended
    without a whisper, a strong kill -9 on Linux for example.

    If you have those final lines then it means the sync process is properly
    finished. It may have encountered problems though.

    A good synchronization is mentioned by some lines above the last ones,
    especially those three lines:

      The sync looks good, all 1745 identified messages in host1 are on host2.
      There is no unidentified message on host1.
      Detected 0 errors

    Imapsync mentions the total sizes of both accounts at the beginning of
    the sync and also at the end. Sometimes, even with a strict sync, those
    total sizes differ, and sometimes they differ a lot. The difference is
    not a good criterion to conclude the sync went wrong.

    Why? That's because message sizes given by the imap servers are not
    always accurate, they are not always the same as the actual message
    sizes of the messages transferred by imapsync. Imapsync use the sizes
    given by the imap servers to calculate the big total size. They can
    differ. In the early days, Imapsync used the sizes of the messages as
    one of the criteria to identify the messages, different sizes implied
    different messages; but it was a mistake, the same message had different
    sizes on both sides sometimes, depending on the imap servers.

    Another explanation for a big total size difference is that Gmail
    doesn't count the size of duplicate messages across folders twice, while
    imapsync does.

    A classical scenario is synchronizing a mailbox B from another mailbox A
    where you just want to keep a strict copy of A in B. Strict meaning all
    messages in A will be in B but no more.

    For a strict synchronization, use the option --delete2. The option
    --delete2 deletes the messages in the host2 folder B that are not in the
    host1 folder A. If you also need to destroy host2 folders that are not
    in host1 then use --delete2folders. See also --delete2foldersonly and
    --delete2foldersbutnot to set up exceptions on folders to destroy. INBOX
    will never be destroyed, it's a mandatory folder in IMAP so imapsync
    doesn't even try to remove it.

    A different scenario is to delete the messages from the source mailbox
    after a successful transfer, it can be a good feature when migrating
    mailboxes since messages will be only on one side. The source account
    will only have messages that are not on the destination yet, ie,
    messages that arrived after a sync or that failed to be transferred.

    In that case, use the --delete1 option. Option --delete1 implies also
    the option --expunge1 so all messages marked deleted on host1 will be
    deleted. In IMAP protocol deleting a message does not delete it, it
    marks it with the flag \Deleted, allowing an undelete. Expunging a
    folder removes, definitively, all the messages marked as \Deleted in
    this folder.

    You can also decide to remove empty folders once all of their messages
    have been transferred. Add --delete1emptyfolders to obtain this
    behavior.

    Imapsync is not adequate for maintaining two active imap accounts in
    synchronization when the user plays independently on both sides. Use
    offlineimap (written by John Goerzen) or mbsync (written by Michael R.
    Elkins) for a 2 ways synchronization.

OPTIONS

     usage: imapsync [options]

    The standard options are the six values forming the credentials. Three
    values on each side are needed to login into the IMAP servers. These six
    values are a hostname, a username, and a password, two times.

    Here are the conventions used in the following descriptions of the
    options:

     str means a string
     int means an integer number
     flo means a float number
     reg means a regular expression
     cmd means a command

     --dry               : Makes imapsync do nothing for real; it just prints what
                           would be done without --dry.

  OPTIONS/credentials

     --host1        str  : Source or "from" imap server.
     --port1        int  : Port to connect on host1.
                           Optional since default ports are the
                           well known ports imap/143 or imaps/993.
     --user1        str  : User to login on host1.
     --password1    str  : Password of user1.

     --host2        str  : "destination" imap server.
     --port2        int  : Port to connect on host2. Optional
     --user2        str  : User to login on host2.
     --password2    str  : Password of user2.

     --showpasswords     : Shows passwords on output instead of "MASKED".
                           Useful to restart a complete run by just reading
                           the command line used in the log,
                           or to debug passwords.
                           It's not a secure practice at all!

     --passfile1    str  : Password file for the user1. It must contain the
                           password on the first line. This option avoids showing
                           the password on the command line like --password1 does.
     --passfile2    str  : Password file for the user2.

    You can also pass the passwords in the environment variables
    IMAPSYNC_PASSWORD1 and IMAPSYNC_PASSWORD2. If you don't pass the user1
    password via --password1 nor --passfile1 nor $IMAPSYNC_PASSWORD1 then
    imapsync will prompt to enter the password on the terminal. Same thing
    for user2 password.

  OPTIONS/encryption

     --nossl1            : Do not use a SSL connection on host1.
     --ssl1              : Use a SSL connection on host1. On by default if possible.

     --nossl2            : Do not use a SSL connection on host2.
     --ssl2              : Use a SSL connection on host2. On by default if possible.

     --notls1            : Do not use a TLS connection on host1.
     --tls1              : Use a TLS connection on host1. On by default if possible.

     --notls2            : Do not use a TLS connection on host2.
     --tls2              : Use a TLS connection on host2. On by default if possible.

     --debugssl     int  : SSL debug mode from 0 to 4.

     --sslargs1     str  : Pass any ssl parameter for host1 ssl or tls connection. Example:
                           --sslargs1 SSL_verify_mode=1 --sslargs1 SSL_version=SSLv3
                           See all possibilities in the new() method of IO::Socket::SSL
                           http://search.cpan.org/perldoc?IO::Socket::SSL#Description_Of_Methods
     --sslargs2     str  : Pass any ssl parameter for host2 ssl or tls connection.
                           See --sslargs1

  OPTIONS/authentication

     --authmech1    str  : Auth mechanism to use with host1:
                           PLAIN, LOGIN, CRAM-MD5 etc. Use UPPERCASE.
     --authmech2    str  : Auth mechanism to use with host2. See --authmech1

     --authuser1    str  : User to auth with on host1 (admin user).
                           Avoid using --authmech1 SOMETHING with --authuser1.
     --authuser2    str  : User to auth with on host2 (admin user).
     --proxyauth1        : Use proxyauth on host1. Requires --authuser1.
                           Required by Sun/iPlanet/Netscape IMAP servers to
                           be able to use an administrative user.
     --proxyauth2        : Use proxyauth on host2. Requires --authuser2.

     --authmd51          : Use MD5 authentication for host1.
     --authmd52          : Use MD5 authentication for host2.
     --domain1      str  : Domain on host1 (NTLM authentication).
     --domain2      str  : Domain on host2 (NTLM authentication).

     --oauthaccesstoken1 str : The access token to authenticate with OAUTH2.
                           It will be combined with the --user1 value to form the 
                           string to pass with XOAUTH2 authentication.
                           The password given by --password1 or --passfile1
                           is ignored but needed on the command line.
                           Instead of the access token itself, the value can be a
                           file containing the access token on the first line.
                           If the value is a file, imapsync reads its first line
                           and take this line as the access token. The advantage
                           of the file is that if the access token changes then
                           imapsync can read it again when it needs to reconnect 
                           during a run.


     --oauthaccesstoken2 str : same thing as --oauthaccesstoken1 

     --oauthdirect1 str  : The direct string to pass with XOAUTH2 authentication.
                           The password given by --password1 or --passfile1 and 
                           the user given by --user1 are ignored but they are 
                           needed to be on the command line. Consider it a bug.

     --oauthdirect2 str  : same thing as oauthdirect1

  OPTIONS/folders

     --folder       str  : Sync this folder.
     --folder       str  : and this one, etc.
     --folderrec    str  : Sync this folder recursively.
     --folderrec    str  : and this one, etc.

     --folderfirst  str  : Sync this folder first. Ex. --folderfirst "INBOX"
     --folderfirst  str  : then this one, etc.
     --folderlast   str  : Sync this folder last. --folderlast "[Gmail]/All Mail"
     --folderlast   str  : then this one, etc.

     --nomixfolders      : Do not merge folders when host1 is case-sensitive
                           while host2 is not (like Exchange). Only the first
                           similar folder is synced. Example: with folders
                           "Sent", "SENT" and "sent" on host1, only "Sent"
                           will be synced to host2.

     --skipemptyfolders  : Empty host1 folders are not created on host2.

     --include      reg  : Sync folders matching this regular expression
     --include      reg  : or this one, etc.
                           If both --include --exclude options are used, then
                           include is done before.
     --exclude      reg  : Skips folders matching this regular expression
                           Several folders to avoid:
                            --exclude 'fold1|fold2|f3' skips fold1, fold2 and f3.
     --exclude      reg  : or this one, etc.

     --automap           : guesses folders mapping, for folders well known as
                           "Sent", "Junk", "Drafts", "All", "Archive", "Flagged".

     --f1f2    str1=str2 : Force folder str1 to be synced to str2,
                           --f1f2 overrides --automap and --regextrans2.
                           Use several --f1f2 options to map several folders.
                           Option --f1f2 is a one to one only folder mapping,
                           str1 and str2 have to be full path folder names.

     --subfolder2   str  : Syncs the whole host1 folders hierarchy under the
                           host2 folder named str.
                           It does it internally by adding three
                           --regextrans2 options before all others.
                           Add --debug to see what's really going on.

     --subfolder1   str  : Syncs the host1 folders hierarchy which is under folder
                           str to the root hierarchy of host2.
                           It's the counterpart of a sync done by --subfolder2
                           when doing it in the reverse order.
                           Backup/Restore scenario:
                           Use --subfolder2 str for a backup to the folder str
                           on host2. Then use --subfolder1 str for restoring
                           from the folder str, after inverting
                           host1/host2 user1/user2 values.


     --subscribed        : Transfers subscribed folders.
     --subscribe         : Subscribe to the folders transferred on the
                           host2 that are subscribed on host1. On by default.
     --subscribeall      : Subscribe to the folders transferred on the
                           host2 even if they are not subscribed on host1.

     --prefix1      str  : Remove prefix str to all destination folders,
                           usually "INBOX." or "INBOX/" or an empty string "".
                           imapsync guesses the prefix if host1 imap server
                           does not have NAMESPACE capability. So this option
                           should not be used most of the time.
     --prefix2      str  : Add prefix to all host2 folders. See --prefix1

     --sep1         str  : Host1 separator. This option should not be used
                           most of the time.
                           Imapsync gets the separator from the server itself,
                           by using NAMESPACE, or it tries to guess it
                           from the folders listing (it counts
                           characters / . \\ \ in folder names and choose the
                           more frequent, or finally / if nothing is found.
     --sep2         str  : Host2 separator. See --sep1

     --regextrans2  reg  : Apply the whole regex to each destination folders.
     --regextrans2  reg  : and this one. etc.
                           When you play with the --regextrans2 option, first
                           add also the safe options --dry --justfolders
                           Then, when happy, remove --dry for a run, then
                           remove --justfolders for the next ones.
                           Have in mind that --regextrans2 is applied after
                           the automatic prefix and separator inversion.
                           For examples see:
                           https://imapsync.lamiral.info/FAQ.d/FAQ.Folders_Mapping.txt

  OPTIONS/folders sizes

     --nofoldersizes     : Do not calculate the size of each folder at the
                           beginning of the sync. Default is to calculate them.
     --nofoldersizesatend: Do not calculate the size of each folder at the
                           end of the sync. Default is to calculate them.
     --justfoldersizes   : Exit after having printed the initial folder sizes.

  OPTIONS/tmp

     --tmpdir       str  : Where to store temporary files and subdirectories.
                           Will be created if it doesn't exist.
                           Default is system specific, Unix is /tmp but
                           /tmp is often too small and deleted at reboot.
                           --tmpdir /var/tmp should be better.

     --pidfile      str  : The file where imapsync pid is written,
                           it can be dirname/filename complete path.
                           The default name is imapsync.pid in tmpdir.

     --pidfilelocking    : Abort if pidfile already exists. Useful to avoid
                           concurrent transfers on the same mailbox.

  OPTIONS/log

     --nolog             : Turn off logging on file
     --logfile      str  : Change the default log filename (can be dirname/filename).
     --logdir       str  : Change the default log directory. Default is LOG_imapsync/

    The default logfile name is for example

     LOG_imapsync/2019_12_22_23_57_59_532_user1_user2.txt

    where:

     2019_12_22_23_57_59_532 is nearly the date of the start
     YYYY_MM_DD_HH_MM_SS_mmm
     year_month_day_hour_minute_second_millisecond

    and user1 user2 are the --user1 --user2 values.

  OPTIONS/messages

     --skipmess     reg  : Skips messages matching the regex.
                           Example: 'm/[\x80-\xff]/' # to avoid 8bits messages.
                           --skipmess is applied before --regexmess
     --skipmess     reg  : or this one, etc.

     --skipcrossduplicates : Avoid copying messages that are already copied
                             in another folder, good from Gmail to XYZ when
                             XYZ is not also Gmail.
                             Activated with --gmail1 unless --noskipcrossduplicates

     --debugcrossduplicates : Prints which messages (UIDs) are skipped with
                              --skipcrossduplicates and in what other folders
                              they are.

     --pipemess     cmd  : Apply this cmd command to each message content
                           before the copy.
     --pipemess     cmd  : and this one, etc.
                           With several --pipemess, the output of each cmd
                           command (STDOUT) is given to the input (STDIN)
                           of the next command.
                           For example,
                           --pipemess cmd1 --pipemess cmd2 --pipemess cmd3
                           is like a Unix pipe:
                           "cat message | cmd1 | cmd2 | cmd3"

     --disarmreadreceipts : Disarms read receipts (host2 Exchange issue)

     --regexmess    reg  : Apply the whole regex to each message before transfer.
                           Example: 's/\000/ /g' # to replace null characters
                           by spaces.
     --regexmess    reg  : and this one, etc.
 
     --truncmess    int  : truncates messages when their size exceed the int 
                           value, specified in bytes. Good to sync too big 
                           messages or to "suppress" attachments. 
                           Have in mind that this way, messages become 
                           uncoherent somehow.

  OPTIONS/labels

    Gmail present labels as folders in imap. Imapsync can accelerate the
    sync by syncing X-GM-LABELS, it will avoid to transfer messages when
    they are already on host2 in another folder.

     --synclabels        : Syncs also Gmail labels when a message is copied to host2.
                           Activated by default with --gmail1 --gmail2 unless
                           --nosynclabels is added.

     --resynclabels      : Resyncs Gmail labels when a message is already on host2.
                           Activated by default with --gmail1 --gmail2 unless
                           --noresynclabels is added.

    For Gmail syncs, see also:
    https://imapsync.lamiral.info/FAQ.d/FAQ.Gmail.txt

  OPTIONS/flags

     If you encounter flag problems see also:
     https://imapsync.lamiral.info/FAQ.d/FAQ.Flags.txt

     --regexflag    reg  : Apply the whole regex to each flags list.
                           Example: 's/"Junk"//g' # to remove "Junk" flag.
     --regexflag    reg  : then this one, etc.

     --resyncflags       : Resync flags for already transferred messages.
                           On by default.
     --noresyncflags     : Do not resync flags for already transferred messages.
                           May be useful when a user has already started to play
                           with its host2 account.

     --filterbuggyflags  : Filter flags known to be buggy and generators of errors
                           "BAD Invalid system flag" or "NO APPEND Invalid flag list".

  OPTIONS/deletions

     --delete1           : Deletes messages on host1 server after a successful
                           transfer. Option --delete1 has the following behavior:
                           it marks messages as deleted with the IMAP flag
                           \Deleted, then messages are really deleted with an
                           EXPUNGE IMAP command. If expunging after each message
                           slows down too much the sync then use
                           --noexpungeaftereach to speed up, expunging will then be
                           done only twice per folder, one at the beginning and
                           one at the end of a folder sync.

     --expunge1          : Expunge messages on host1 just before syncing a folder.
                           Expunge is done per folder.
                           Expunge aims is to really delete messages marked deleted.
                           An expunge is also done after each message copied
                           if option --delete1 is set (unless --noexpungeaftereach).

     --noexpunge1        : Do not expunge messages on host1.

     --delete1emptyfolders : Deletes empty folders on host1, INBOX excepted.
                             Useful with --delete1 since what remains on host1
                             is only what failed to be synced.

     --delete2           : Delete messages in the host2 account that are not in
                           the host1 account. Useful for backup or pre-sync.
                           --delete2 implies --uidexpunge2

     --delete2duplicates : Deletes messages in host2 that are duplicates in host2.
                           Works only without --useuid since duplicates are
                           detected with an header part of each message.
                           NB: --delete2duplicates is far less violent than --delete2
                           since it removes only duplicates.

     --delete2folders    : Delete folders in host2 that are not in host1.
                           For safety, first try it like this, it is safe:
                           --delete2folders --dry --justfolders --nofoldersizes
                           and see what folders will be deleted.

     --delete2foldersonly   reg : Delete only folders matching the regex reg.
                                  Example: --delete2foldersonly "/^Junk$|^INBOX.Junk$/"
                                  This option activates --delete2folders

     --delete2foldersbutnot reg : Do not delete folders matching the regex rex.
                                  Example: --delete2foldersbutnot "/Tasks$|Contacts$|Foo$/"
                                  This option activates --delete2folders

     --noexpunge2        : Do not expunge messages on host2.
     --nouidexpunge2     : Do not uidexpunge messages on the host2 account
                           that are not on the host1 account.

  OPTIONS/dates

     If you encounter problems with dates, see also:
     https://imapsync.lamiral.info/FAQ.d/FAQ.Dates.txt

     --syncinternaldates : Sets the internal dates on host2 as the same as host1.
                           Turned on by default. Internal date is the date
                           a message arrived on a host (Unix mtime usually).
     --idatefromheader   : Sets the internal dates on host2 as same as the
                           ones in "Date:" headers.

  OPTIONS/message selection

     --maxsize      int  : Skip messages larger  (or equal) than  int  bytes
     --minsize      int  : Skip messages smaller (or equal) than  int  bytes

     --maxage       int  : Skip messages older than  int days.
                           final stats (skipped) don't count older messages
                           see also --minage
     --minage       int  : Skip messages newer than  int  days.
                           final stats (skipped) don't count newer messages
                           You can do (+ zone are the messages selected):
                           past|----maxage+++++++++++++++>now
                           past|+++++++++++++++minage---->now
                           past|----maxage+++++minage---->now (intersection)
                           past|++++minage-----maxage++++>now (union)

     --search       str  : Selects only messages returned by this IMAP SEARCH
                           command. Applied on both sides.
                           For a complete set of what can be search see
                           https://imapsync.lamiral.info/FAQ.d/FAQ.Messages_Selection.txt

     --search1      str  : Same as --search but for selecting host1 messages only.
     --search2      str  : Same as --search but for selecting host2 messages only.
                           So --search CRIT equals --search1 CRIT --search2 CRIT

     --noabletosearch    : Makes --minage and --maxage options use the internal
                           dates given by a FETCH imap command instead of the
                           "Date:" header. Internal date is the arrival date
                           in the mailbox.
                           --noabletosearch equals --noabletosearch1 --noabletosearch2

     --noabletosearch1   : Like --noabletosearch but for host1 only.
     --noabletosearch2   : Like --noabletosearch but for host2 only.

     --maxlinelength int : skip messages with a line length longer than  int  bytes.
                           RFC 2822 says it must be no more than 1000 bytes but
                           real life servers and email clients do more.


     --useheader    str  : Use this header to compare messages on both sides.
                           Example: "Message-Id" or "Received" or "Date".
     --useheader    str    and this one, etc.

     --syncduplicates    : Sync also duplicates. Off by default.

     --usecache          : Use cache to speed up next syncs. Off by default.
     --nousecache        : Do not use cache. Caveat: --useuid --nousecache creates
                           duplicates on multiple runs.

     --useuid            : Use UIDs instead of headers as a criterion to recognize
                           messages. Option --usecache is then implied unless
                           --nousecache is used.

  OPTIONS/miscellaneous

     --syncacls          : Synchronizes acls (Access Control Lists).
                           Acls in IMAP are not standardized, be careful
                           since one acl code on one side may signify something
                           else on the other one.
     --nosyncacls        : Does not synchronize acls. This is the default.

     --addheader         : When a message has no headers to be identified,
                           --addheader adds a "Message-Id" header,
                           like "Message-Id: 12345@imapsync", where 12345
                           is the imap UID of the message on the host1 folder.
                           Useful to sync folders "Sent" or "Draft".

  OPTIONS/debugging

     --debug             : Debug mode.
     --debugfolders      : Debug mode for the folders part only.
     --debugcontent      : Debug content of the messages transferred. Huge output.
     --debugflags        : Debug mode for flags.
     --debugimap1        : IMAP debug mode for host1. Very verbose.
     --debugimap2        : IMAP debug mode for host2. Very verbose.
     --debugimap         : IMAP debug mode for host1 and host2. Twice very verbose.
     --debugmemory       : Debug mode showing memory consumption after each copy.

     --errorsmax     int : Exit when int number of errors is reached. Default is 50.

     --tests             : Run local non-regression tests. Exit code 0 means all ok.
     --testslive         : Run a live test with test1.lamiral.info imap server.
                           Useful to check the basics. Needs internet connection.
     --testslive6        : Run a live test with ks6ipv6.lamiral.info imap server.
                           Useful to check the ipv6 connectivity. Needs internet.

  OPTIONS/specific

      --gmail1           : sets --host1 to Gmail and other options. See FAQ.Gmail.txt
      --gmail2           : sets --host2 to Gmail and other options. See FAQ.Gmail.txt

      --office1          : sets --host1 to Office365 and other options. See FAQ.Office365.txt
      --office2          : sets --host2 to Office365 and other options. See FAQ.Office365.txt

      --exchange1        : sets options for Exchange. See FAQ.Exchange.txt
      --exchange2        : sets options for Exchange. See FAQ.Exchange.txt

      --domino1          : sets options for Domino. See FAQ.Domino.txt
      --domino2          : sets options for Domino. See FAQ.Domino.txt

  OPTIONS/behavior

     --timeout1     flo  : Connection timeout in seconds for host1.
                           Default is 120 and 0 means no timeout at all.
     --timeout2     flo  : Connection timeout in seconds for host2.
                           Default is 120 and 0 means no timeout at all.

                           Caveat, under CGI context, you may encounter a timeout
                           from the webserver, killing imapsync and the imap connections.
                           See the document INSTALL.OnlineUI.txt and search
                           for "Timeout" for how to deal with this issue.

     --keepalive1        : https://metacpan.org/pod/Mail::IMAPClient#Keepalive
                           Some firewalls and network gears like to timeout connections 
                           prematurely if the connection sits idle.
                           This option enables SO_KEEPALIVE on the host1 socket.
                           --keepalive1 is on by default since imapsync release 2.169
                           Use --nokeepalive1 to disable it.
                       
     --keepalive2        : Same as --keepalive2 but for host2.
                           Use --nokeepalive2 to disable it.

     --maxmessagespersecond flo : limits the average number of messages 
                                  transferred per second.

     --maxbytespersecond int : limits the average transfer rate per second.
     --maxbytesafter     int : starts --maxbytespersecond limitation only after
                               --maxbytesafter amount of data transferred.

     --maxsleep      flo : do not sleep more than int seconds.
                           On by default, 2 seconds max, like --maxsleep 2

     --abort             : terminates a previous call still running.
                           It uses the pidfile to know what process to abort.

     --exitwhenover int  : Stop syncing and exits when int total bytes
                           transferred is reached.

     --version           : Print only the software version.
     --noreleasecheck    : Do not check for any new imapsync release.
     --releasecheck      : Check for new imapsync release.
                           it's an http request to
                           http://imapsync.lamiral.info/prj/imapsync/VERSION

      --emailreport1     : Put the email final report in host1 INBOX
      --emailreport2     : Put the email final report in host2 INBOX

      --noemailreport1   : Do not put the email final report in host1 INBOX
      --noemailreport2   : Do not put the email final report in host2 INBOX

     --noid              : Do not send/receive IMAP "ID" command to imap servers.

     --justconnect       : Just connect to both servers and print useful
                           information. Need only --host1 and --host2 options.
                           Obsolete since "imapsync --host1 imaphost" alone
                           implies --justconnect

     --justlogin         : Just login to both host1 and host2 with users
                           credentials, then exit.

     --justfolders       : Do only things about folders (ignore messages).

     --help              : print this help.

     Example: to synchronize imap account "test1" on "test1.lamiral.info"
                         to  imap account "test2" on "test2.lamiral.info"
                         with test1 password "secret1"
                         and  test2 password "secret2"

     imapsync \
        --host1 test1.lamiral.info --user1 test1 --password1 secret1 \
        --host2 test2.lamiral.info --user2 test2 --password2 secret2

SECURITY

    You can use --passfile1 instead of --password1 to mention the password
    since it is safer. With --password1 option, on Linux, any user on your
    host can see the password by using the 'ps auxwwww' command. Using a
    variable (like IMAPSYNC_PASSWORD1) is also dangerous because of the 'ps
    auxwwwwe' command. So, saving the password in a well protected file (600
    or rw-------) is the best solution.

    Imapsync activates ssl or tls encryption by default, if possible.

    What detailed behavior is under this "if possible"?

    Imapsync activates ssl if the well known port imaps port (993) is open
    on the imap servers. If the imaps port is closed then it open a normal
    (clear) connection on port 143 but it looks for TLS support in the
    CAPABILITY list of the servers. If TLS is supported then imapsync goes
    to encryption with STARTTLS.

    If the automatic ssl and the tls detections fail then imapsync will not
    protect against sniffing activities on the network, especially for
    passwords.

    If you want to force ssl or tls just use --ssl1 --ssl2 or --tls1 --tls2

    See also the document FAQ.Security.txt in the FAQ.d/ directory or at
    https://imapsync.lamiral.info/FAQ.d/FAQ.Security.txt

EXIT STATUS

    Imapsync will exit with a 0 status (return code) if everything went
    good. Otherwise, it exits with a non-zero status. That's classical Unix
    behavior. Here is the list of the exit code values (an integer between 0
    and 255). In Bourne Shells, this exit code value can be retrieved within
    the variable value "$?" if you read it just after the imapsync call.

    The names reflect their meaning:

         EX_OK          => 0  ; #/* successful termination */
         EX_USAGE       => 64 ; #/* command line usage error */
         EX_NOINPUT     => 66 ; #/* cannot open input */
         EX_UNAVAILABLE => 69 ; #/* service unavailable */
         EX_SOFTWARE    => 70 ; #/* internal software error */
         EXIT_CATCH_ALL              =>   1 ; # Any other error
         EXIT_BY_SIGNAL              =>   6 ; # Should be 128+n where n is the sig_num
         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_TESTS_FAILED           => 254 ; # Like Test::More API
         EXIT_CONNECTION_FAILURE_HOST1     =>  101 ;
         EXIT_CONNECTION_FAILURE_HOST2     =>  102 ;
         EXIT_AUTHENTICATION_FAILURE_USER1 =>  161 ;
         EXIT_AUTHENTICATION_FAILURE_USER2 =>  162 ;

LICENSE AND COPYRIGHT

    Imapsync is free, open, public but not always gratis software cover by
    the NOLIMIT Public License, now called NLPL. See the LICENSE file
    included in the distribution or just read the following simple sentence
    as it IS the license text:

     "No limits to do anything with this work and this license."

    In case it is not long enough, I repeat:

     "No limits to do anything with this work and this license."

    Look at https://imapsync.lamiral.info/LICENSE

AUTHOR

    Gilles LAMIRAL <[email protected]>

    Good feedback is always welcome. Bad feedback is very often welcome.

    Gilles LAMIRAL earns his living by writing, installing, configuring and
    sometimes teaching free, open, and often gratis software. Imapsync used
    to be "always gratis" but now it is only "often gratis" because imapsync
    is sold by its author, your servitor, a good way to maintain and support
    free open public software tools over decades.

BUGS AND LIMITATIONS

    See https://imapsync.lamiral.info/FAQ.d/FAQ.Reporting_Bugs.txt

IMAP SERVERS supported

    See https://imapsync.lamiral.info/S/imapservers.shtml

HUGE MIGRATION

    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 ... have to be replaced by nothing or any imapsync option. Welcome
    in shell or batch programming !

    You will find already written scripts at
    https://imapsync.lamiral.info/examples/

INSTALL

     Imapsync works under any Unix with Perl.

     Imapsync works under most Windows (2000, XP, Vista, Seven, Eight, Ten
     and all Server releases 2000, 2003, 2008 and R2, 2012 and R2, 2016)
     as a standalone binary software called imapsync.exe, usually launched
     from a batch file in order to avoid always typing the options. There
     is also a 32bit binary called imapsync_32bit.exe

     Imapsync works under OS X as a standalone binary software called
     imapsync_bin_Darwin

     Purchase latest imapsync at
     https://imapsync.lamiral.info/

     You'll receive a link to a compressed tarball called
     imapsync-x.xx.tgz where x.xx is the version number. 
     Untar the tarball where you want (on Unix):

      tar xzvf  imapsync-x.xx.tgz

     Go into the directory imapsync-x.xx and read the INSTALL file.
     As mentioned at https://imapsync.lamiral.info/#install
     the INSTALL file can also be found at
     https://imapsync.lamiral.info/INSTALL.d/INSTALL.ANY.txt
     It is now split in several files for each system
     https://imapsync.lamiral.info/INSTALL.d/

CONFIGURATION

    There is no specific configuration file for imapsync, everything is
    specified by the command line parameters and the default behavior.

HACKING

    Feel free to hack imapsync as the NOLIMIT license permits it.

SIMILAR SOFTWARE

      See also https://imapsync.lamiral.info/S/external.shtml
      for a better up to date list.

    List verified on Friday July 1, 2021.

     imapsync: https://github.com/imapsync/imapsync (this is an imapsync copy, sometimes delayed, with --noreleasecheck by default since release 1.592, 2014/05/22)
     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
     imaputils: https://github.com/mtsatsenko/imaputils (very old imap_tools fork)
     Doveadm-Sync: https://wiki2.dovecot.org/Tools/Doveadm/Sync ( Dovecot sync tool )
     davmail: http://davmail.sourceforge.net/
     offlineimap: http://offlineimap.org/
     fdm: https://github.com/nicm/fdm
     mbsync: http://isync.sourceforge.net/
     mailsync: http://mailsync.sourceforge.net/
     mailutil: https://www.washington.edu/imap/ part of the UW IMAP toolkit. (well, seems abandoned now)
     imaprepl: https://bl0rg.net/software/ http://freecode.com/projects/imap-repl/
     imapcopy (Pascal): http://www.ardiehl.de/imapcopy/
     imapcopy (Java): https://code.google.com/archive/p/imapcopy/
     imapsize: http://www.broobles.com/imapsize/
     migrationtool: http://sourceforge.net/projects/migrationtool/
     imapmigrate: http://sourceforge.net/projects/cyrus-utils/
     larch: https://github.com/rgrove/larch (derived from wonko_imapsync, good at Gmail)
     wonko_imapsync: http://wonko.com/article/554 (superseded by larch)
     pop2imap: http://www.linux-france.org/prj/pop2imap/ (I wrote that too)
     exchange-away: http://exchange-away.sourceforge.net/
     SyncBackPro: http://www.2brightsparks.com/syncback/sbpro.html
     ImapSyncClient: https://github.com/ridaamirini/ImapSyncClient
     MailStore: https://www.mailstore.com/en/products/mailstore-home/
     mnIMAPSync: https://github.com/manusa/mnIMAPSync
     imap-upload: http://imap-upload.sourceforge.net/ (A tool for uploading a local mbox file to IMAP4 server)
     imapbackup: https://github.com/rcarmo/imapbackup (A Python script for incremental backups of IMAP mailboxes)
     BitRecover email-backup 99 USD, 299 USD https://www.bitrecover.com/email-backup/.
     ImportExportTools: https://addons.thunderbird.net/en-us/thunderbird/addon/importexporttools/ ImportExportTools for Mozilla Thunderbird by Paolo Kaosmos. ImportExportTools does not do IMAP.
     rximapmail: https://sourceforge.net/projects/rximapmail/
     CodeTwo: https://www.codetwo.com/ but CodeTwo does imap source to Office365 only.

HISTORY

    I initially wrote imapsync in July 2001 because an enterprise, called
    BaSystemes, paid me to install a new imap server without losing huge old
    mailboxes located in a far away remote imap server, accessible by an
    often broken low-bandwidth ISDN link.

    I had to verify every mailbox was well transferred, all folders, all
    messages, without wasting bandwidth or creating duplicates upon resyncs.
    The imapsync design was made with the beautiful rsync command in mind.

    Imapsync started its life as a patch of the copy_folder.pl script. The
    script copy_folder.pl comes from the Mail-IMAPClient-2.1.3 perl module
    tarball source (more precisely in the examples/ directory of the
    Mail-IMAPClient tarball).

    So many changes happened since then that I wonder if it remains any
    lines of the original copy_folder.pl in imapsync source code.

imapsync's People

Contributors

arjenz avatar danielwagn3r avatar daveserpa avatar dszymczuk avatar exander77 avatar fhe-odoo avatar florenthemmi avatar freddlespl0it avatar gilleslamiral avatar jazzzz avatar mendel5 avatar mmoya avatar nbebout avatar nextsux avatar pchaitat avatar pkirk avatar polluks avatar rkarlsba avatar rzr avatar ssteve avatar tapsiturtle avatar tux2000 avatar zszs73 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imapsync's Issues

Getting error for one specific account

Hi, migrating several accounts from Google apps to Office 365 Exchange via IMAP. Process is working beautifully for 4 accounts, but one account has constant errors in the logs and doesn't seem to be progressing.

I am getting this error, and the process for this account doesn't ever seem to end even though it has 10% as much data as the rest of the accounts, in terms of number of folders, number of messages and byte size of all attachments and messages.

Use of uninitialized value $sockargs[11] in join or string at /usr/share/perl5/Mail/IMAPClient.pm line 360.
Host2 folder Bufkin Cara 1512 selected: 230 messages,  duplicates: 0
 43/758 [Bufkin Cara 1601]                  -> [Bufkin Cara 1601]
Host2: Subscribing to folder Bufkin Cara 1601
Host2 folder Bufkin Cara 1601 selected: 185 messages,  duplicates: 0
 44/758 [Buonopane Katy 1509]               -> [Buonopane Katy 1509]
Host2: Subscribing to folder Buonopane Katy 1509
Use of uninitialized value $sockargs[11] in join or string at /usr/share/perl5/Mail/IMAPClient.pm line 360.```


Here is my code:

```bash

cd /opt/mailSyncConfigs/${username}

runSync() {
        imapsync \
                --no-modules_version \
                --host1 imap.gmail.com --port1 993 --ssl1 --authmech1 PLAIN --user1 "${username}@${domain1}" --passfile1 pass1 \
                --host2 outlook.office365.com --port2 993 --ssl2 --authmech2 PLAIN --user2 "${username}@${domain2}" --passfile2 pass2 \
                --delete2duplicates \
                --noexpunge \
                --pidfile "/opt/mail/${username}/imapsync.pid" \
                --pidfilelocking \
                --logdir "." \
                --logfile "sync.log" \
                --tmpdir "./tmp"
}

Each dir in mailSyncConfig has pass1 and pass2 text files. All 5 users setup the same on both sides and in the sync configs.

Any ideas?

Set logfile-path or logfile?

Hi,

there is a confusing description for --logfile.

Starting imapsync will write the following line in the logfile:
Log file is LOG_imapsync/xxx.txt ( to change it, use --logfile filepath ; or use --nolog to turn off logging )

The documentation will tell you another truth:
--logfile <string> : Change the default logfile pathname and filename.

Wish:
1.) One correct descripton
2.) It would be nice, when you could set the filepath without a specific filename

Regards,
Jens

Map folder names?

On the destination server by default the folders are named differently so it creates new folders instead of using existing ones, example:

Creates INBOX.Deleted+Messages instead of using existing INBOX.Trash
Creates INBOX.Sent+Messages instead of using existing INBOX.Sent

Maybe this is because of the source server, maybe they are named that way there. Not sure but anyway I think it would be interesting to have parameters to map folder names from source to destination.

Support for X-GM-LABELS extension

See Gmail's IMAP Extensions for details.

Use Case:

When migrating from another IMAP account to a Gmail IMAP account, in addition to copying the folders and messages from the source IMAP account to corresponding "folders" and messages in the Gmail account, it is possible to apply additional labels to the stored messages using the IMAP STORE command with the X-GM-LABELS extension.

In particular, the user may wish to apply a common label to the messages being migrated. For example, if the user is migrating from "[email protected]" to "[email protected]", she may wish to apply the label myoldaccount to all the messages so that they can easily be reviewed after the migration.

New Options

The imapsync command should be provided these new options:

--setlabel1 NEWLABEL      # set NEWLABEL on IMAP1 messages that are successfully copied
--setlabel2 NEWLABEL      # set NEWLABEL on IMAP2 messages that are successfully copied

Of course, these options only work for IMAP servers supporting the X-GM-LABELS extension (i.e., Gmail).

Full support of the X-GM-LABELS feature suggests that there be filters also:

--select-label LABEL      # select messages labeled with LABEL
--exclude-label LABEL     # select messages NOT labeled with LABEL

In addition to the common use case of --setlabel2 to identify the source of the newly migrated messages in the IMAP2 account, the combination of --setlabel1 and --exclude-label can help the user see which messages have been copied/migrated and which have not.

Let me know if you would like assistance in this implementation.

fix version for Mail::IMAPClient

Hi,

when using
Mail::IMAPClient 3.29

with imapsync (1.670) then I get the following error:
Not a SCALAR reference at /usr/lib/perl5/vendor_perl/5.10.0/Mail/IMAPClient.pm line 426.

with
Mail::IMAPClient 3.32

it works

encoding

When I sync the mailboxes in the names of folders that have Cyrillic characters
I'm getting invalid names in the console (utf8)
need to re-encode the output of utf7 in utf8

INBOX.&BD4EPwQ4BEEEOA- &BD8EOARBBDUEPA-
--->>>
INBOX.описи писем

piece of code
(sorry I do not know much Perl)

my $str45;
$str45=$h1_folders_all[2];
substr($str45,6,1)="+";
substr($str45,23,1)="+";

Encode::from_to($str45,'utf7','utf8');

Can't use an undefined value as a HASH reference at /usr/local/Cellar/imapsync/1.678/libexec/bin/imapsync line 1470.

Had this error first:

Can't use an undefined value as a HASH reference at /usr/local/imapsync/1.678/libexec/bin/imapsync line 1459.
I believe the stated fix is documented at http://www.linux-france.org/prj/imapsync_list/msg02454.html. Made that change.

Now I get this error:

Can't use an undefined value as a HASH reference at /usr/local/Cellar/imapsync/1.678/libexec/bin/imapsync line 1470.

And Host1: found 0 folders.

Transfer started at Sat Mar 26 00:57:29 2016
PID is 23399
Log file is LOG_imapsync/[email protected] ( to change it, use --logfile path ; or use --nolog to turn off logging )
$RCSfile: imapsync,v $ $Revision: 1.678 $ $Date: 2016/01/21 19:47:02 $ 
Here is a [darwin] system (Darwin mylaptop.local 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64)
With perl 5.18.2 Mail::IMAPClient  3.35
Command line used:
/usr/local/Cellar/imapsync/1.678/libexec/bin/imapsync --nosyncacls --syncinternaldates --subscribe --syncinternaldates --useheader Message-ID --nofoldersizes --ssl1 --host1 imap.secureserver.net --user1 [email protected] --password1 MASKED --noauthmd5 --ssl2 --host2 outlook.office365.com --user2 [email protected] --password2 MASKED --noauthmd5 --addheader --skipemptyfolders --regexflag s/\Flagged//g --disarmreadreceipts --maxsize 45000000 --maxlinelength 10500 --exclude ^Trash$ --exclude ^Junk$ --exclude ^spam$ --exclude ^viruses$ --exclude ^Contacts$ --exclude ^RSS Feeds$ --exclude ^Suggested Contacts$ --exclude ^Emailed Contacts$ --exclude ^users-inbox/Trash$ --exclude ^users-inbox/Junk$ --exclude ^users-inbox/spam$ --exclude ^users-inbox/viruses$ --exclude ^users-inbox/Contacts$ --exclude ^users-inbox/Emailed Contacts$ --regextrans2 s#^Sent$#Sent Items#
Temp directory is /var/folders/y_/w_pbl7355vg3gv5xkmsld49m0000gn/T  ( to change it use --tmpdir dirpath )
PID file is /var/folders/y_/w_pbl7355vg3gv5xkmsld49m0000gn/T/imapsync.pid ( to change it use --pidfile filepath ; to avoid it use --pidfile "" )
/var/folders/y_/w_pbl7355vg3gv5xkmsld49m0000gn/T/imapsync.pid already exists, overwriting it ( use --pidfilelocking to avoid concurrent runs )
Modules version list:
Mail::IMAPClient     3.35
IO::Socket           1.36
IO::Socket::IP       ?
IO::Socket::INET     1.33
IO::Socket::SSL      1.966
Net::SSLeay          1.58
Compress::Zlib       2.06
Digest::MD5          2.52
Digest::HMAC_MD5     1.01
Digest::HMAC_SHA1    1.03
Term::ReadKey        2.31
File::Spec           3.40
Time::HiRes          1.9725
Unicode::String      2.09
IO::Tee              0.64
File::Copy::Recursive 0.38
Authen::NTLM         1.09
URI::Escape          3.31
Data::Uniqid         ?
JSON                 ?
JSON::WebToken       ?
Crypt::OpenSSL::RSA  0.28
LWP                  6.05
HTML::Entities       3.69
Filesys::DfPortable  ?
( use --no-modules_version to turn off printing this Perl modules list )
Use --sslargs1 SSL_verify_mode=1 for SSL_VERIFY_PEER on host1
Use --sslargs2 SSL_verify_mode=1 for SSL_VERIFY_PEER on host2
ssl debug mode level is --debugssl 1 (can be set from 0 meaning no debug to 4 meaning max debug)
Info: turned ON syncinternaldates, will set the internal dates (arrival dates) on host2 same as host1.
Host1: will try to use LOGIN authentication on host1
Host2: will try to use LOGIN authentication on host2
Host1: imap connexion timeout is 120 seconds
Host2: imap connexion timeout is 120 seconds
Host1: IMAP server [imap.secureserver.net] port [993] user [[email protected]]
Host2: IMAP server [outlook.office365.com] port [993] user [[email protected]]
Checking each --regexmess command with an empty string.
Ok with each --regexmess
Checking each --regexflag command with an empty string.
Ok with each --regexflag
Host1: connecting and login on host1 [imap.secureserver.net] port [993] with user [[email protected]]
Use of uninitialized value $sockargs[9] in join or string at /usr/local/Cellar/imapsync/1.678/libexec/lib/perl5/Mail/IMAPClient.pm line 360.
Host1 banner: * OK [CAPABILITY IMAP4rev1 UNSELECT STARTTLS ID CHILDREN NAMESPACE IDLE AUTH=PLAIN] Courier-IMAP ready. Copyright 1998-2004 Double Precision, Inc.  See COPYING for distribution information.
Host1: imap.secureserver.net says it has NO CAPABILITY for AUTHENTICATE LOGIN
Host1: success login on [imap.secureserver.net] with user [[email protected]] auth [LOGIN]
Host2: connecting and login on host2 [outlook.office365.com] port [993] with user [[email protected]]
Use of uninitialized value $sockargs[9] in join or string at /usr/local/Cellar/imapsync/1.678/libexec/lib/perl5/Mail/IMAPClient.pm line 360.
Host2 banner: * OK The Microsoft Exchange IMAP4 service is ready. [RABNADIAUABSADAAOQBDAEEAMAAwADIANwAuAG4AYQBtAHAAcgBkADAAOQAuAHAAcgBvAGQALgBvAHUAdABsAG8AbwBrAC4AYwBvAG0A]
Host2: outlook.office365.com says it has NO CAPABILITY for AUTHENTICATE LOGIN
Host2: success login on [outlook.office365.com] with user [[email protected]] auth [LOGIN]
Host1: state Authenticated
Host2: state Authenticated
Host1 capability: IMAP4rev1 UNSELECT STARTTLS ID CHILDREN NAMESPACE IDLE AUTH=PLAIN
Host2 capability: IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CLIENTACCESSRULES CLIENTNETWORKPRESENCELOCATION CHILDREN IDLE NAMESPACE LITERAL+
Host1: found 0 folders.
Host2: found 13 folders.
Including all folders found by default. Use --subscribed or --folder or --folderrec or --include to select specific folders. Use --exclude to unselect specific folders.
Excluding folders matching pattern ^Trash$

Excluding folders matching pattern ^Junk$

Excluding folders matching pattern ^spam$

Excluding folders matching pattern ^viruses$

Excluding folders matching pattern ^Contacts$

Excluding folders matching pattern ^RSS Feeds$

Excluding folders matching pattern ^Suggested Contacts$

Excluding folders matching pattern ^Emailed Contacts$

Excluding folders matching pattern ^users-inbox/Trash$

Excluding folders matching pattern ^users-inbox/Junk$

Excluding folders matching pattern ^users-inbox/spam$

Excluding folders matching pattern ^users-inbox/viruses$

Excluding folders matching pattern ^users-inbox/Contacts$

Excluding folders matching pattern ^users-inbox/Emailed Contacts$

Host1: checking all wanted folders exist.
Host1: checking all wanted folders are selectable. Use --nocheckselectable to avoid this check.
Use of uninitialized value $sep_guessed in concatenation (.) or string at /usr/local/Cellar/imapsync/1.678/libexec/bin/imapsync line 3769.
Host1: guessing separator from folder listing: []
Host1: separator given by NAMESPACE: [/]
Host2: guessing separator from folder listing: [/]
Host2: separator given by NAMESPACE: [/]
Use of uninitialized value $prefix_guessed in concatenation (.) or string at /usr/local/Cellar/imapsync/1.678/libexec/bin/imapsync line 3704.
Host1: guessing prefix from folder listing: []
Host1: prefix given by NAMESPACE: []
Host2: guessing prefix from folder listing: []
Host2: prefix given by NAMESPACE: []
Host1 separator and prefix: [/][]
Host2 separator and prefix: [/][]
Turned off automapping folders ( use --automap to turn on automapping )

++++ Listing folders
All foldernames are presented between brackets like [X] where X is the foldername.
When a foldername contains non-ASCII characters it is presented in the form
[X] = [Y] where
X is the imap foldername you have to use in command line options and
Y is the uft8 output just printed for convenience, to recognize it.

Host1 folders list:

Host2 folders list:
[Calendar]
[Calendar/Birthdays]
[Calendar/United States holidays]
[Contacts]
[Deleted Items]
[Drafts]
[INBOX]
[Journal]
[Junk Email]
[Notes]
[Outbox]
[Sent Items]
[Tasks]

Folders in host2 not in host1:
[Tasks]
[Sent Items]
[Outbox]
[Notes]
[Junk Email]
[Journal]
[INBOX]
[Drafts]
[Deleted Items]
[Contacts]
[Calendar/United States holidays]
[Calendar/Birthdays]
[Calendar]

Can't use an undefined value as a HASH reference at /usr/local/Cellar/imapsync/1.678/libexec/bin/imapsync line 1470.

Different signatures generated from identical header

Hello,

I've come across a problem with some messages being downloaded every time I run imapsync. After adding --debug and checking logs I think there's an issue with parsing multiline fields in headers.

Example mail below. Raw header is identical on Host1 and Host2, but generated signatures are different. Notice that only Host1 is using BODY[PEEK.HEADER]. IPs and emails are xxx-ed for privacy reasons.

Host1 banner: * OK xxx IdeaImapServer v0.80.1 ready
Host1 capability: IMAP4rev1 LITERAL+ CHILDREN I18NLEVEL=1 IDLE SORT UIDPLUS UNSELECT XLIST

Host2 banner: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready.
Host2 capability: IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SPECIAL-USE

Host1 uid 163 head nb pass one: 0
Host1 uid 163 no header by parse_headers so taking whole header with BODY.PEEK[HEADER]
Host1 uid 163 head nb pass two: 16
Host1 uid 163 header [MESSAGE-ID: <000001D0185A$B3B6A880$1B23F980$xxxx>]
Host1 uid 163 header [RECEIVED: FROM SAMSUNG (xxx) (USING TLSV1.2 WITH CIPHER ECDHE-RSA-AES256-SHA384 (256/256 BITS)) (NO CLIENT CERTIFICATE REQUESTED)]
Host1 uid 163 header [RECEIVED: FROM xxx (xxx) (HELO xxx) BY xxx (xxx) WITH SMTP (IDEASMTPSERVER V0.80) ID BEFCBBB97BE6C685; MON, 15 DEC 2014 12:31:43 +0100]
Host1 uid 163 sig rnW1WGRAqqaVVoT+rbqnTQ size 6541 idate 15-Dec-2014 12:31:43 +0100

Host2 uid 163 head nb pass one: 2
Host2 uid 163 header [MESSAGE-ID: <000001D0185A$B3B6A880$1B23F980$xxxx>]
Host2 uid 163 header [RECEIVED: FROM SAMSUNG (xxx) (USING TLSV1.2 WITH CIPHER ECDHE-RSA-AES256-SHA384 (256/256 BITS)) (NO CLIENT CERTIFICATE REQUESTED) (AUTHENTICATED SENDER: xxx) BY xxx (xxx) WITH ESMTPSA ID 3K1L6643D9ZZ9TKR FOR ; MON, 15 DEC 2014 12:31:41 +0100 (CET)]
Host2 uid 163 header [RECEIVED: FROM xxx (xxx) (HELO xxx) BY xxx (xxx) WITH SMTP (IDEASMTPSERVER V0.80) ID BEFCBBB97BE6C685; MON, 15 DEC 2014 12:31:43 +0100]
Host2 uid 163 sig 2ZYv8JufO+9wznsB8bQwSw size 6541 idate 15-Dec-2014 12:31:43 +0100

And this is raw header, 100% identical on both hosts if fetched with BODY[PEEK.HEADER]. What is interesting, first "Received" field has spaces and second has tabulators:

Return-Path: \r\nReceived: from xxx (xxx) (HELO xxx)\r\n by xxx (xxx) with SMTP (IdeaSmtpServer v0.80)\r\n id befcbbb97be6c685; Mon, 15 Dec 2014 12:31:43 +0100\r\nReceived: from Samsung (xxx)\r\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))\r\n\t(No client certificate requested)\r\n\t(Authenticated sender: xxx)\r\n\tby xxx (xxx) with ESMTPSA id 3k1L6643d9zZ9tKr\r\n\tfor ; Mon, 15 Dec 2014 12:31:41 +0100 (CET)\r\nDKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xxx; s=2011;\r\n\tt=1418643102; bh=9Sa9ZJBmGCXolg5K372V7XiTHd9ZHueYVH8WHTAqyEI=;\r\n\th=From:To:References:In-Reply-To:Subject:Date:Message-ID:\r\n\t MIME-Version:Content-Type;\r\n\tb=qYK+YNGvsplPI0fueGSin3VotAFHOUtnFVfSIvteBJGwv+7Bh5H0jCH9ueTau/x90\r\n\t 4EwuZfCVPzma5+PpoPN5YmhLVOOiuvFsPZtGrIEFDQ1X7SIzBNvs/JzaTeIEw0OZv9\r\n\t nmy3eisN4f535cYJFU/zCSmLYBtWpLgZNkbES7to=\r\nFrom: "xxx" \r\nTo: "'xxx'" \r\nReferences: <000f01d0183e$8e4a3010$aade9030$xxxx>\r\nIn-Reply-To: <000f01d0183e$8e4a3010$aade9030$xxxx>\r\nSubject: xxx\r\nDate: Mon, 15 Dec 2014 12:31:42 +0100\r\nMessage-ID: <000001d0185a$b3b6a880$1b23f980$xxxx>\r\nMIME-Version: 1.0\r\nContent-Type: multipart/alternative;\r\n\tboundary="----=_NextPart_000_0001_01D01863.157B1080"\r\nX-Mailer: Microsoft Outlook 15.0\r\nThread-Index: xxx\r\nContent-Language: pl\r\n\r\n

First "Received":

Received: from xxx (xxx) (HELO xxx)\r\n
**(space)**by xxx (xxx) with SMTP (IdeaSmtpServer v0.80)\r\n
**(space)**id befcbbb97be6c685; Mon, 15 Dec 2014 12:31:43 +0100\r\n

Second:

Received: from Samsung (xxx)\r\n
\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))\r\n
\t(No client certificate requested)\r\n
\t(Authenticated sender: xxx)\r\n
\tby xxx (xxx) with ESMTPSA id 3k1L6643d9zZ9tKr\r\n
\tfor ; Mon, 15 Dec 2014 12:31:41 +0100 (CET)\r\n

I hope this is sufficient information to fix this problem.

Login failure when IMAP is disabled

Hi!

I'm trying to sync an email account like this "[email protected]" but the IMAP server returns the following message:

Host1: will try to use LOGIN authentication on host1
Host2: will try to use LOGIN authentication on host2
Host1: imap connexion timeout is 120 seconds
Host2: imap connexion timeout is 120 seconds
Host1: IMAP server [mail.example.com] port [143] user [[email protected]]
Host2: IMAP server [mx.example.es] port [143] user [[email protected]]
Host1: connecting and login on host1 [mail.example.com] port [143] with user [[email protected]]
Host1 banner: * OK IceWarp 10.4.4 IMAP4rev1 Wed, 24 Feb 2016 21:07:50 +0100
Host1: mail.example.com says it has CAPABILITY for AUTHENTICATE LOGIN
Host1 failure: Error login on [mail.example.com] with user [[email protected]] auth [LOGIN]: 2 NO LOGIN Unknown user or incorrect password

When I sync another account with a domain that not contains a dash character, the migration is sucessful.

I'm using the lastest version of imapsync.

imapsync --host1 mail.example.com --user1 "[email protected]" --password1 "12345" --host2 mx.example.es --user2 "[email protected]" --password2 "12345"

$RCSfile: imapsync,v $ $Revision: 1.678 $ $Date: 2016/01/21 19:47:02 $

Modules version list:
Mail::IMAPClient     3.35
IO::Socket           1.36
IO::Socket::IP       ?
IO::Socket::INET     1.33
IO::Socket::SSL      1.965
Net::SSLeay          1.58
Compress::Zlib       2.06
Digest::MD5          2.52
Digest::HMAC_MD5     1.01
Digest::HMAC_SHA1    1.03
Term::ReadKey        2.31
File::Spec           3.40
Time::HiRes          1.9725
Unicode::String      2.09
IO::Tee              0.64
File::Copy::Recursive 0.38
Authen::NTLM         1.09
URI::Escape          3.31
Data::Uniqid         0.12
JSON                 ?
JSON::WebToken       ?
Crypt::OpenSSL::RSA  ?
LWP                  6.05
HTML::Entities       3.69
Filesys::DfPortable  ?

Timeout does not work on --justconnect

I didnt want to wait 120 seconds for --justconnect to fail in a test im running. So i set the parameter --timeout 5. This did not work however, it seems like --timeout does not work when using --justconnect

Patch: GroupWise Trusted App Support

I've written a patch to imapsync to add support for GroupWise Trusted Apps via imap. This allows you to sync to or from GroupWise without knowing the source or destination user's password - similar to the "admin" login on many other imap servers. I'm actively using it, and am happy to share it here (and have someone critique/fix my attempt to patch perl), if interested.

Build fails on Windows

Just for the record:
Building on Windows fails will running make test for Unicode::String with

t/charname.t ... Can't use 'defined(%hash)' (Maybe you should just omit the defined()?) at C:\STRAWB~1\cpan\build\Unicode-String-2.09-mFsIO0\blib\lib/Unicode/CharName.pm line 80.

According to https://rt.cpan.org/Public/Bug/Display.html?id=74354

This affects all perls from 5.21.0 onwards

So, use Strawberry Perl 5.20.3.1

Cheers

High CPU load and very poor performance

Hi,

I´m running imapsync-1.569-1.el6.noarch on a Centos 6.5 x64 system. I´m trying to sync from a dovecot imap to a cyrus imap server but the performance is very poor

0.01 msgs/s 63.780 KiB/s ETA: Mon Dec 2 22:31:21 2013 28528 s 328 msgs left
0.01 msgs/s 65.135 KiB/s ETA: Tue Dec 3 01:17:36 2013 38356 s 327 msgs left
0.01 msgs/s 65.076 KiB/s ETA: Mon Dec 2 21:44:20 2013 25560 s 326 msgs left
0.01 msgs/s 65.238 KiB/s ETA: Mon Dec 2 23:08:44 2013 30484 s 325 msgs left
0.01 msgs/s 65.181 KiB/s ETA: Mon Dec 2 21:26:25 2013 24344 s 324 msgs left
0.02 msgs/s 65.122 KiB/s ETA: Mon Dec 2 20:18:12 2013 20251 s 323 msgs left
0.02 msgs/s 65.235 KiB/s ETA: Mon Dec 2 19:46:36 2013 18332 s 322 msgs left

and the cpu is during the sync at 100%
Can you please help me out with this issue? Thank you

only 'Top' folder of --f1f2 is correctly redirected but not subfolders

Did sync from HOST1 (Exchange 2013) to HOST2 (IMAP by jimdo.com)
imapsync,v $ $Revision: 1.670
--f1f2 'Gesendete Elemente'='INBOX.Sent'

Folders mapping from --f1f2 options, it overrides --automap:
[INBOX]                                  -> [Eingang]                               
[Gesendete Elemente]                     -> [INBOX.Sent]                            
[Entw&APw-rfe] = [Entwürfe]             -> [INBOX.Drafts]                          
[Gel&APY-schte Elemente] = [Gelöschte Elemente] -> [INBOX.Trash]                           
[Junk-E-Mail]                            -> [INBOX.spam]

but only the top folder is remapped ...

 74/183 [Gesendete Elemente]                -> [INBOX.Sent]                       
 75/183 [Gesendete Elemente/Kunden]         -> [INBOX.Gesendete Elemente.Kunden]

when I use

--regextrans2 's/INBOX\.Gesendete\ Elemente/INBOX\.Sent/'

then it works ...

74/183 [Gesendete Elemente]                -> [INBOX.Sent]                       
 75/183 [Gesendete Elemente/Kunden]         -> [INBOX.Sent.Kunden]                
Creating folder [INBOX.Sent.Kunden] on host2

but the doku is saying that ...

--f1f2 overrides --automap and --regextrans2

which is not true in this case ...
if you need more info then please let me know ...
Thank you :)

a large number of letters

++++ Calculating sizes on Host1
Host1 folder [INBOX] 65 NO Error in IMAP command received by server. at /usr/bin/imapsync line 2302
main::die_clean('65 NO Error in IMAP command received by server.') called at /usr/bin/imapsync line 2811
main::foldersizes('Host1', 'Mail::IMAPClient=HASH(0x899adfc)', undef, 'INBOX', 'INBOX.&BD4EMQRDBEcENQQ9BDgENQ-', 'INBOX.&BD4EPwQ4BEEEOA- &BD8EOARBBDUEPA-', 'INBOX.&BD4EPwQ7BDAEQgQw-', 'INBOX.&BD4EQgQ,BEMEQQQ6BDA-', 'INBOX.&BD4EQgQ,BEMEQQQ6BDA-.2012', ...) called at /usr/bin/imapsync line 1139

if you use the-nofoldersizes all works
and the work is not interrupted
but the error is displayed

Compare duplicates only by headers is buggy

I have two messages (full source, address mangled):

From: [email protected]
Subject: quota warning

Your mailbox is now below% full.

and

From: [email protected]
Subject: quota warning

Your mailbox is now 80% full.

When I sync directory with they by imapsync 1.607 I got:

++++ End looping on each folder
++++ Calculating sizes on Host1
Host1 folder [BAK_test/Ant/Archives/2014]        Size:     18371 Messages:     7 Biggest:     10827
Host1 Nb messages:               7 messages
…
++++ Calculating sizes on Host2
Host2 folder [BAK/Ant/Archives/2014]             Size:     18280 Messages:     6 Biggest:     10827
Host2 Nb messages:               6 messages
…
++++ Statistics
Transfer started on               : Sat Jan 17 21:10:21 2015
Transfer ended on                 : Sat Jan 17 21:10:32 2015
Transfer time                     : 11.0 sec
Messages transferred              : 0
Messages skipped                  : 7
Messages found duplicate on host1 : 1
Messages found duplicate on host2 : 0
Messages void (noheader) on host1 : 0
Messages void (noheader) on host2 : 0
Messages deleted on host1         : 0
Messages deleted on host2         : 0
…
Initial difference host2 - host1  : -1 messages, -91 bytes (-0.089 KiB)
Final   difference host2 - host1  : -1 messages, -91 bytes (-0.089 KiB)

So, they are treated as duplicates which are not! It seems as bug for me.
It will be good to see compare full mail byte-to-byte before threat as duplicates. Or at least such option.

In sync options --useheader ALL --addheader used, so I do not see how I could make compare strictly.

Use UIDs seams as possibility there, but I do not want depends on cache present.

BAD Command Argument Error. 11

I try to sync mail from a SBS 2003 Std R2 to a SBS 2011 Std R2.
But there are still some minor errors which I do not know how to fix.

  • msg INBOX/MA - Mark T/361 {11760721} couldn't append (Subject:[AW: Vortrag Seminar Krakau]) to folder INBOX/MA - Mark T: Error sending 'APPEND "INBOX/MA - Mark T" (\Seen) "17-Oct-2011 20:38:01 +0100" {11760721}': * BYE Connection closed. 14; 1482 BAD Command Argument Error. 11

any help would be appreciated.
Thanks :)

Gmail Too Many Simultaneous Connections Workaround

Anyone know of a way around the 15 connection limitation? I've written a script to allow me to multi-thread imapsyncs of individual folders for my accounts. I thought I'd be able to push dozens but just discovered that Gmail kills connections after 15. :(

outlook.com does support IMAP

your list of supported servers states outlook.com doesn't support IMAP but they actually do now:

IMAP Server: imap-mail.outlook.com 993 SSL
SMTP Server: smtp-mail.outlook.com 587 TLS

UTF7 to UTF8 decoding bugs

Firstly there bug and you by some reason exclude + sign from utf7 string which leads to its mangle. For example in Russian language word project is "проект" what in UTF7-IMAP encoding represent as "&BB8EQAQ+BDUEOgRC-" but imapsync decode it as "ПроBDUEOgRC-"

I have breaffy look at code and by some reason you are especially leave + sign in imap_utf7_decode routine:

sub imap_utf7_decode {
        $s =~ s/\+/PLUSPLACEHOLDER/g ;
        $s =~ s/&([^,&\-]*),([^,\-&]*)\-/&$1\/$2\-/g ;
        $s =~ s/&(?!\-)/\+/g ;
        $s =~ s/&\-/&/g ;
        $s =~ s/PLUSPLACEHOLDER/+-/g ;

        return( Unicode::String::utf7( $s )->utf8 ) ;
}

Additionally I want mention, despite some folder names decoded, in many place except folders list it present as is, for example:

Excluding folders matching pattern 'BAK_test/Ant/INBOX': [BAK_test/Ant/INBOX/&BB8EQAQ+BDEEOwQ1BDwESw- &BD8EPg- &BD4EQgRHBFEEQgQwBDw- &BEEEQAQwBDIEPQQ1BD0EOARP-] [BAK_test/Ant/INBOX/TODO] [BAK_test/
Ant/INBOX/TODO-ANSWER] [BAK_test/Ant/INBOX/TODO/Answer - &BCEEPgQxBD4EOwQ1BDI-]
…

minage and maxage not working

I'm finishing up a migration effort (GroupWise to Zimbra) where I used imapsync to migrate stuff. A few users didn't get everything in their mailbox, either because of a stupid GW setting that limited IMAP to only see 20K items per folder, or because their account on the destination side hit its quota. So, I'm trying to go back and migrate things from very large folders with many years of e-mail. Most users have given me a date range that is missing, so I'm trying to use the --minage and --maxage parameters to limit it down to today - end date for min age and today - start date for max age. However, it seems to be pulling in (and duplicating!) all of the messages, which is leading to some annoyance and frustration as people have to manually remove all of the duplicate instances. The full command I'm using is below - maybe someone can point out where I have options that might be causing issues for the minage and maxage parameters? In theory the below command should only migrate e-mails from the INBOX folder that are older than 26 days old and newer than 246 days?

~/bin/imapsync
--timeout 0 --maxsize 52428800 --buffersize 52428800
--fastio1 --fastio2
--nofoldersizes --nosyncacls --subscribe --syncinternaldates
--noauthmd5 --authmech2 PLAIN
--exclude '(?i)\b(Junk|Spam|Trash|Calendar|Tasks)\b'
--skipheader 'X-'
--skipheader '^Content-Type'
--regexflag 's/\(?!Answered|Flagged|Deleted|Seen|Recent|Draft)[^\s]
\s*//ig'
--regextrans2 's,:,-,g'
--regextrans2 's,",''',g'
--regextrans2 's,\s+(?=/|$),,g'
--regextrans2 's,^(Briefcase|Contacts|Emailed Contacts|Notebook|Tasks)(?=/|$), $1 Folder,ig'
--regextrans2 's/Sent Items$/Sent/'
--host1 old.imap.server --port1 993 --host2 new.zimbra.server --sep1 "/" --prefix1 ""
--gwtapp1 "trustedapp" --gwtappkey1 ""
--user1 "Old User" --user2 "Old.User" --password1 "blah"
--authuser2 "[email protected]" --password2 blahPassword
--regextrans2 's,",-,g'
--regextrans2 's,&AAo-|&AA0ACg-|&AA0ACgANAAo-(?=/|$),,g'
--ssl1 --tls2 --authmech1 LOGIN
--nofoldersizes --skipsize
--search1 "NOT HEADER Sender @lists.mydomain.com"
--useheader ALL --delete2duplicates
--folder INBOX --minage 26 --maxage 246

Square Brackets

How to avoid this problem:

msg INBOX/75223 {2952} couldn't append (Subject:[Terminal de Recolha de Dados - ScanPhone Honeywell]) to folder INBOX: 20 NO APPEND error converting message

Seems that square brackets causes the error, as I have a bunch of them with the same error and all of them have square brackets in the subject

Login failure

Hi,

I've used this tool previously and found it to be quiet successful. I'm now using it for a new project, but having difficulties with login!

I have and admin user on host1, that I can use to access the mail in user inboxes using Apple Mail (as a test), so I attempt to use that account like so...

(I've generalised the domain and user names)

./imapsync/imapsync \ --tls1 --host1 host.domain.net --user1="[email protected]" ---authuser1 "adminuser" --password1 mysecret \ --tls2 --host2 outlook.office365.com --user2 [email protected] --authuser2 [email protected] --passfile2 "/root/officeAdminPassword"

Host1: will try to use LOGIN authentication on host1
Host2: will try to use PLAIN authentication on host2
Host1: imap connexion timeout is 120 seconds
Host2: imap connexion timeout is 120 seconds
Host1: IMAP server [host.domain.com] port [143] user [[email protected]]
Host2: IMAP server [outlook.office365.com] port [143] user [[email protected]]
Host1: connecting and login on host1 [host1.domain.com] port [143] with user [[email protected]]
Host1 banner: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE NAMESPACE STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
Host1: Socket successfuly converted to SSL
Host1: host1.domain.com says it has CAPABILITY for AUTHENTICATE LOGIN
Host1 failure: Error login on [host.domain.com] with user [[email protected]] auth [LOGIN]: 3 NO [AUTHENTICATIONFAILED] Authentication failed.

I noticed the reference to Dovecot, so I checked the FAQ and found the reference to using --user1 "user*admin" and tried that, but it didn't seem to help.

One thing to note is that the admin user in this case is not an email address of the form '[email protected]', but rather 'adminuser'. Not sure if this would make any difference.

Once again - I've confirmed that this admin user account can access regular user emails by testing in Apple Mail. I've also double and triple checked the password.

I realise this is probably a user error, but any help you could provide would be greatly appreciated.

Thanks :)

PREFIX=/usr/local

The makefile uses /usr as the default prefix; IMO /usr/local would be a safer default, because most of the mainstream distros reserve /usr for the package manager, while packages installed from source go into /usr/local. AFAIK, it's more common to see packages default to /usr/local when pulled from source control, and distros to change this to /usr when building packages for their repositories.

starttls does not work as expected

Hello,

I have a problem using imapsync with the german hoster "hetzner" - the starttls sequence is not being started correctly. I have already tried several command line options without success. It seems the sequence is not being initiated correctly.
After "1 OK Begin TLS negotiation now" the Negotiation does NOT take place.
I tried also older versions of imapsync ans also the last one from the git repository without success.

If needed I can provide a mail-account on that server.

Here is my console log:
root@hetzner1:~/mailSync# ./sync_loop_unix.sh
Looping on account credentials found in file.txt

==== Syncing user [email protected] to user [email protected] ====
Transfer started at Thu Oct 29 18:18:59 2015
PID is 14789
Log file is LOG_imapsync/[email protected] ( to change it, use --logfile filepath ; or use --nolog to turn off logging )
$RCSfile: imapsync,v $ $Revision: 1.644 $ $Date: 2015/07/17 01:22:52 $
Here is a [linux] system (Linux someserver.internet.local 2.6.32-504.8.1.el6.x86_64 #1 SMP Wed Jan 28 21:11:36 UTC 2015 x86_64)
With perl 5.10.1 Mail::IMAPClient 3.34
Command line used:
./imapsync --host1 mail.ims-firmen.de --user1 [email protected] --password1 MASKED --host2 mail.your-server.de --user2 [email protected] --password2 MASKED --tls2 --port2 143 --debugimap2 --usecache --useuid --tmpdir ./cache
Temp directory is ./cache ( to change it use --tmpdir dirpath )
PID file is ./cache/imapsync.pid ( to change it use --pidfile filepath ; to avoid it use --pidfile "" )
Modules version list:
Mail::IMAPClient 3.34
IO::Socket 1.31
IO::Socket::IP ?
IO::Socket::INET 1.31
IO::Socket::SSL 1.31
Net::SSLeay 1.35
Compress::Zlib 2.021
Digest::MD5 2.39
Digest::HMAC_MD5 1.01
Digest::HMAC_SHA1 1.01
Term::ReadKey 2.30
File::Spec 3.3
Time::HiRes 1.9721
Unicode::String 2.09
IO::Tee 0.64
File::Copy::Recursive 0.38
Authen::NTLM ?
URI::Escape 3.29
Data::Uniqid ?
JSON::WebToken ?
( use --no-modules_version to turn off printing this Perl modules list )
Info: turned ON syncinternaldates, will set the internal dates (arrival dates) on host2 same as host1.
Info: will try to use LOGIN authentication on host1
Info: will try to use LOGIN authentication on host2
Info: imap connexions timeout is 120 seconds
Host1: IMAP server [mail.ims-firmen.de] port [143] user [[email protected]]
Host2: IMAP server [mail.your-server.de] port [143] user [[email protected]]
Host1: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN AUTH=DIGEST-MD5 AUTH=CRAM-MD5] Dovecot ready.
Host1: mail.ims-firmen.de says it has CAPABILITY for AUTHENTICATE LOGIN
Host1: success login on [mail.ims-firmen.de] with user [[email protected]] auth [LOGIN]
Host2 connection
Connecting with IO::Socket::INET PeerAddr mail.your-server.de PeerPort 143 Proto tcp Timeout 120 Debug 1
Connected to mail.your-server.de
Read: * OK [CAPABILITY IMAP4 IMAP4rev1 STARTTLS UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION] perdition ready on sslproxy01.your-server.de 0002f017
Host2: * OK [CAPABILITY IMAP4 IMAP4rev1 STARTTLS UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION] perdition ready on sslproxy01.your-server.de 0002f017
Sending: 1 STARTTLS
Sent 12 bytes
Read: 1 OK Begin TLS negotiation now
Sending: 2 CAPABILITY
Sent 14 bytes
Read: * CAPABILITY IMAP4 IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION
Read: 2 OK CAPABILITY
Host2: mail.your-server.de says it has NO CAPABILITY for AUTHENTICATE LOGIN
Sending literal: 3 LOGIN [email protected] {13}
then: itsmypassword
Sending: 3 LOGIN [email protected] {13}
Sent 44 bytes
Read: + OK ready for additional input
Sending: itsmypassword
Sent 14 bytes
Read: 3 NO failed: Re-Authentication Failure
ERROR: 3 NO failed: Re-Authentication Failure at /usr/share/perl5/vendor_perl/Mail/IMAPClient.pm line 1364
Mail::IMAPClient::ANON('3 NO failed: Re-Authentication Failure\x{d}\x{a}') called at /usr/share/perl5/vendor_perl/Mail/IMAPClient.pm line 1400
Mail::IMAPClient::_get_response('Mail::IMAPClient=HASH(0x121c230)', 3, undef) called at /usr/share/perl5/vendor_perl/Mail/IMAPClient.pm line 1326
Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x121c230)', 'LOGIN [email protected] {13}\x{d}\x{a}itsmypassword\x{d}') called at /usr/share/perl5/vendor_perl/Mail/IMAPClient.pm line 1225
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x121c230)', 'LOGIN [email protected] {13}\x{d}\x{a}itsmypassword\x{d}') called at /usr/share/perl5/vendor_perl/Mail/IMAPClient.pm line 576
Mail::IMAPClient::login('Mail::IMAPClient=HASH(0x121c230)') called at ./imapsync line 2269
main::authenticate_imap('Mail::IMAPClient=HASH(0x121c230)', 'mail.your-server.de', 143, '[email protected]', undef, 'itsmypassword\x{d}', 1, 120, 0, ...) called at ./imapsync line 2236
main::login_imap('mail.your-server.de', 143, '[email protected]', undef, 'itsmypassword\x{d}', 1, 120, 0, undef, ...) called at ./imapsync line 1017
ERROR: 3 NO failed: Re-Authentication Failure at /usr/share/perl5/vendor_perl/Mail/IMAPClient.pm line 1274
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x121c230)', 'LOGIN [email protected] {13}\x{d}\x{a}itsmypassword\x{d}') called at /usr/share/perl5/vendor_perl/Mail/IMAPClient.pm line 576
Mail::IMAPClient::login('Mail::IMAPClient=HASH(0x121c230)') called at ./imapsync line 2269
main::authenticate_imap('Mail::IMAPClient=HASH(0x121c230)', 'mail.your-server.de', 143, '[email protected]', undef, 'itsmypassword\x{d}', 1, 120, 0, ...) called at ./imapsync line 2236
main::login_imap('mail.your-server.de', 143, '[email protected]', undef, 'itsmypassword\x{d}', 1, 120, 0, undef, ...) called at ./imapsync line 1017
Failure: error login on [mail.your-server.de] with user [[email protected]] auth [LOGIN]: 3 NO failed: Re-Authentication Failure
==== End syncing user [email protected] to user [email protected] ====

Thanks,
Sebastian

SSL_verify_mode must be a number and not a string

Having just upgraded to Fedora 23 I am getting this new error when running imapsync.

get options: [1]
date_str: 2015_11_13_09_27_27
Transfer started at Fri Nov 13 09:27:27 2015
PID is 29282
check_last_release: [1.644]
$RCSfile: imapsync,v $ $Revision: 1.644 $ $Date: 2015/07/17 01:22:52 $ 
Here is a [linux] system (Linux localhost 4.2.5-300.fc23.x86_64 #1 SMP Tue Oct 27 04:29:56 UTC 2015 x86_64)
With perl 5.22.0 Mail::IMAPClient  3.35
Command line used:
/usr/bin/imapsync --nolog --host1 localhost --ssl1 --host2 localhost --justconnect --debug
Temp directory is /tmp  ( to change it use --tmpdir dirpath )
PID file is /tmp/imapsync.pid ( to change it use --pidfile filepath ; to avoid it use --pidfile "" )
Modules version list:
Mail::IMAPClient     3.35
IO::Socket           1.38
IO::Socket::IP       0.37
IO::Socket::INET     1.35
IO::Socket::SSL      2.019
Net::SSLeay          1.71
Compress::Zlib       2.068
Digest::MD5          2.54
Digest::HMAC_MD5     1.01
Digest::HMAC_SHA1    1.03
Term::ReadKey        2.33
File::Spec           3.56
Time::HiRes          1.9726
Unicode::String      2.09
IO::Tee              0.64
File::Copy::Recursive 0.38
Authen::NTLM         1.09
URI::Escape          3.31
Data::Uniqid         0.12
JSON::WebToken       ?
( use --no-modules_version to turn off printing this Perl modules list )
IMAPClient 3.35
SSL_verify_mode must be a number and not a string at /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm line 2092.

I tried using the constants from IO::Socket::SSL as per this diff:

485c485
< #use IO::Socket::SSL ;

---
> use IO::Socket::SSL ;
2327c2327
<       SSL_verify_mode => 'SSL_VERIFY_PEER',

---
>       SSL_verify_mode => SSL_VERIFY_PEER,
2338c2338
<       SSL_verify_mode => 'SSL_VERIFY_NONE',

---
>       SSL_verify_mode => SSL_VERIFY_NONE,

...but then the imap connection just fails:

IMAPClient 3.35
Can not open imap connection on [localhost]: Unable to connect to localhost: 

Thanks!

No valid SSL certicate

Hello,

My IMAP server is using SSL but without a valid SSL certficate

How can I tell imapsync to use SSL without a certicate? Like the novalidate-cert option?

Thanks.

SSL: SSL connect attempt failed with unknown error error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

imapsync and scripting

Hi,

I don´t know if this is a imapsync issue or just my script but I´ll try to explain it.
I have following script:

!/bin/bash

inputfile="migrate_accounts.txt"
host1="10.10.10.1"
host2="localhost"
logfile="/var/log/imapsyncbatch.log"

if [ ! -f $inputfile ]
then
{
echo "The input file does not exist! Exiting..." >> $logfile
exit;
}
fi

date=date +%X_-_%x
echo "$date IMAPSync started..." >> $logfile

tr ";" " " <$inputfile | while read u1 p1 u2 p2
do
date=date +%X_-_%x
echo "$date Start Syncing User $u1 to $u2" >> $logfile
imapsync --dry $1 --exclude Spamfilter.* --buffersize 8192000 --nosyncacls --syncinternaldates
--host1 $host1 --user1 "$u1" --password1 "$p1" --ssl1 --port1 993
--host2 $host2 --user2 "$u2" --password2 "$p2" --ssl2 --port2 993
date=date +%X_-_%x
echo "$date Finished $u1 to $u2" >> $logfile
done

date=date +%X_-_%x
echo "$date IMAPSync Finished..." >> $logfile
echo "$date ------------------------------------" >> $logfile

The migrate_accounts.txt file looks like this:
[email protected];mypass1;[email protected];mypass1;
[email protected];mypass2;[email protected];mypass2;

When I run the script it works fine for some users but for others there seems that imapsync can´t recognize the prefix and separator:

Host1 separator and prefix: [.][INBOX.]
Host2 separator and prefix: [/][Other Users/]

Obviously "Other Users separator "doesn´t exist on the target server so imapsync tries to create them.

I tried to alter the script with --sep2 / --prefix 2 "". This gives me so far the correct prefix and separator but imapsync still tries to create the INBOX Trash Spam etc even though this folders exists on the target server.

And now when i try to run this from the cli

imapsync --dry --exclude Spamfilter.* --buffersize 8192000 --nosyncacls --syncinternaldates
--host1 10.10.10.1 --user1 [email protected] --password1 mypass1 --ssl1 --port1 993
--host2 localhost --user2 [email protected] mypass1 --ssl2 --port2 993 \

it works.

So I dont´t know exactly whats going on. Thank you.

"Use of uninitialized value $sockargs[11]" and "Connection reset by peer"

Hi,

by first thanks for this awesome tool! 👍

Since a few days we're getting alot of these errors.
Sometimes it's $sockargs[11] and sometimes it's $sockargs[13] and so on.

We want to migrate quite a big imap-account to Exchange. (Right aroung 10GiB)

Have you seen these errors before?

Thanks for your help!

Greetings,
Louis

license issue

The README states:

LICENSE
imapsync is free, open source but not always gratis software cover by
the Do What The Fuck You Want To Public License (WTFPL). See COPYING
file included in the distribution or the web site
http://sam.zoy.org/wtfpl/COPYING

This URL is 'rewritten' to http://www.wtfpl.net/txt/copying/
and the content is different from your COPYING file.
Would you please fix it.
Thanks

Imapsync not syncing anything but there are folders visible

When running imapsync between two hosts, I am able to authenticate to both hosts. Host 1 is a clean email account and host 2 contains many folders. When running imapsync, the folders are listed but no mails are transferred.

I'm not sure why this could be. Any help would be greatly appreciated! Below is my output of the imapsync command.

MacBook-Pro-van-Martijn:imapsync-master martijndevos$ perl imapsync --host1 host1.com --user1 [email protected] --password1 secret  --host2 host2.com --user2 [email protected] --password2 secret
Transfer started at Mon Jan 25 21:16:15 2016
PID is 2452
Log file is LOG_imapsync/[email protected] ( to change it, use --logfile path ; or use --nolog to turn off logging )
$RCSfile: imapsync,v $ $Revision: 1.678 $ $Date: 2016/01/21 19:47:02 $ 
Here is a [darwin] system (Darwin MacBook-Pro-van-Martijn.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64)
With perl 5.18.2 Mail::IMAPClient  3.37
Command line used:
imapsync --host1 bmcbouw.no-ip.org --user1 [email protected] --password1 MASKED --host2 mail.bmcbouw.nl --user2 [email protected] --password2 MASKED --tls2 --tls1 --subscribed
Temp directory is /var/folders/r8/d63xy0dx62l8n8mdgpy8dxw00000gn/T  ( to change it use --tmpdir dirpath )
PID file is /var/folders/r8/d63xy0dx62l8n8mdgpy8dxw00000gn/T/imapsync.pid ( to change it use --pidfile filepath ; to avoid it use --pidfile "" )
Modules version list:
Mail::IMAPClient     3.37
IO::Socket           1.36
IO::Socket::IP       ?
IO::Socket::INET     1.33
IO::Socket::SSL      1.966
Net::SSLeay          1.58
Compress::Zlib       2.06
Digest::MD5          2.52
Digest::HMAC_MD5     1.01
Digest::HMAC_SHA1    1.03
Term::ReadKey        2.31
File::Spec           3.40
Time::HiRes          1.9725
Unicode::String      2.09
IO::Tee              0.64
File::Copy::Recursive 0.38
Authen::NTLM         ?
URI::Escape          3.31
Data::Uniqid         ?
JSON                 ?
JSON::WebToken       ?
Crypt::OpenSSL::RSA  0.28
LWP                  6.05
HTML::Entities       3.69
Filesys::DfPortable  ?
( use --no-modules_version to turn off printing this Perl modules list )
ssl debug mode level is --debugssl 1 (can be set from 0 meaning no debug to 4 meaning max debug)
Info: turned ON syncinternaldates, will set the internal dates (arrival dates) on host2 same as host1.
Host1: will try to use LOGIN authentication on host1
Host2: will try to use LOGIN authentication on host2
Host1: imap connexion timeout is 120 seconds
Host2: imap connexion timeout is 120 seconds
Host1: IMAP server [bmcbouw.no-ip.org] port [143] user [[email protected]]
Host2: IMAP server [mail.bmcbouw.nl] port [143] user [[email protected]]
Host1: connecting and login on host1 [bmcbouw.no-ip.org] port [143] with user [[email protected]]
Host1 banner: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN] Dovecot DA ready.
Host1: Socket successfuly converted to SSL
Host1: bmcbouw.no-ip.org says it has NO CAPABILITY for AUTHENTICATE LOGIN
Host1: success login on [bmcbouw.no-ip.org] with user [[email protected]] auth [LOGIN]
Host2: connecting and login on host2 [mail.bmcbouw.nl] port [143] with user [[email protected]]
Host2 banner: * OK Kerio MailServer 6.7.3 patch 1 IMAP4rev1 server ready
Host2: Socket successfuly converted to SSL
Host2: mail.bmcbouw.nl says it has CAPABILITY for AUTHENTICATE LOGIN
Host2: success login on [mail.bmcbouw.nl] with user [[email protected]] auth [LOGIN]
Host1: state Authenticated
Host2: state Authenticated
Host1 capability: IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY MOVE QUOTA
Host2 capability: IMAP4 IMAP4rev1 IDLE ACL LITERAL+ UIDPLUS QUOTA ID SORT ANNOTATE ANNOTATEMORE STATUS-COUNTERS UNSELECT LISTEXT NAMESPACE XLIST AUTH=CRAM-MD5 AUTH=PLAIN AUTH=LOGIN AUTH=DIGEST-MD5

Host2: found quota, presented in raw IMAP
Sending: 5 GETQUOTAROOT INBOX
Sent 22 bytes
Read:   * QUOTAROOT "INBOX" "[email protected]"
    * QUOTA "[email protected]" ()
    5 OK GETQUOTAROOT completed

Host2: Quota current storage is 0 bytes. Limit is 0 bytes. So 0 % full
Host1: found 1 folders.
Host2: found 143 folders.
Host1: checking all wanted folders exist.
Host1: checking all wanted folders are selectable. Use --nocheckselectable to avoid this check.
Host1: guessing separator from folder listing: [/]
Host1: separator given by NAMESPACE: [.]
Host2: guessing separator from folder listing: [/]
Host2: separator given by NAMESPACE: [/]
Host1: guessing prefix from folder listing: []
Host1: prefix given by NAMESPACE: []
Host2: guessing prefix from folder listing: []
Host2: prefix given by NAMESPACE: []
Host1 separator and prefix: [.][]
Host2 separator and prefix: [/][]
Turned off automapping folders ( use --automap to turn on automapping )

++++ Listing folders
All foldernames are presented between brackets like [X] where X is the foldername.
When a foldername contains non-ASCII characters it is presented in the form
[X] = [Y] where
X is the imap foldername you have to use in command line options and
Y is the uft8 output just printed for convenience, to recognize it.

Host1 folders list:
[INBOX]

Host2 folders list:
[Archives]
[Concepten]
[Deleted Items]
[Deleted Messages]
[Drafts]
[Gewiste items]
[INBOX]
[INBOX/Accounts]
... many more ...

Host1 subscribed folders list: 
Folders in host2 not in host1:
[Sent Messages]
[Sent Items]
[Public Folders]
[Junk E-mail]
[Junk]
... many more ...

Folders sizes before the synchronization.
You can remove foldersizes listings by using "--nofoldersizes" and  "--nofoldersizesatend"
but then you will also loose the ETA (Estimation Time of Arrival) given after each message copy.
++++ Calculating sizes of 0 folders on Host1
Host1 Nb folders:                0 folders
Host1 Nb messages:               0 messages
Host1 Total size:                0 bytes (0.000 KiB)
Host1 Biggest message:           0 bytes (0.000 KiB)
Host1 Time spent:              2.0 seconds
++++ Calculating sizes of 0 folders on Host2
Host2 Nb folders:                0 folders
Host2 Nb messages:               0 messages
Host2 Total size:                0 bytes (0.000 KiB)
Host2 Biggest message:           0 bytes (0.000 KiB)
Host2 Time spent:              0.0 seconds
++++ Looping on each one of 0 folders to sync
++++ End looping on each folder

Folders sizes after the synchronization.
You can remove this foldersizes listing by using  "--nofoldersizesatend"
++++ Calculating sizes of 0 folders on Host1
Host1 Nb folders:                0 folders
Host1 Nb messages:               0 messages
Host1 Total size:                0 bytes (0.000 KiB)
Host1 Biggest message:           0 bytes (0.000 KiB)
Host1 Time spent:              0.1 seconds
++++ Calculating sizes of 0 folders on Host2
Host2 Nb folders:                0 folders
Host2 Nb messages:               0 messages
Host2 Total size:                0 bytes (0.000 KiB)
Host2 Biggest message:           0 bytes (0.000 KiB)
Host2 Time spent:              0.0 seconds
++++ Statistics
Transfer started on               : Mon Jan 25 21:16:15 2016
Transfer ended on                 : Mon Jan 25 21:16:19 2016
Transfer time                     : 4.1 sec
Folders synced                    : 0/0 synced
Messages transferred              : 0 
Messages skipped                  : 0
Messages found duplicate on host1 : 0
Messages found duplicate on host2 : 0
Messages void (noheader) on host1 : 0
Messages void (noheader) on host2 : 0
Messages deleted on host1         : 0
Messages deleted on host2         : 0
Total bytes transferred           : 0 (0.000 KiB)
Total bytes duplicate host1       : 0 (0.000 KiB)
Total bytes duplicate host2       : 0 (0.000 KiB)
Total bytes skipped               : 0 (0.000 KiB)
Total bytes error                 : 0 (0.000 KiB)
Message rate                      : 0.0 messages/s
Average bandwidth rate            : 0.0 KiB/s
Reconnections to host1            : 0
Reconnections to host2            : 0
Memory consumption                : 2611.0 MiB
Biggest message                   : 0 bytes
Start difference host2 - host1    : 0 messages, 0 bytes (0.000 KiB)
Final difference host2 - host1    : 0 messages, 0 bytes (0.000 KiB)
Detected 0 errors


Homepage: http://imapsync.lamiral.info/
Log file is LOG_imapsync/[email protected] ( to change it, use --logfile filepath ; or use --nolog to turn off logging )

"sync, copy or migration tool"

Good morning!

Could you give an example of these cases or put it in the readme?

  • copy all emails from host1 to host2 (maybe with an overwrite option)
  • copy all emails from host2 to host1 would it be just swapping options on the command line?
  • syncronize all emails in both direction

Ubuntu installation instructions.

Hi,
I followed the advice in INSTALL.d/INSTALL.Ubuntu.txt

I found I also needed
"sudo cpan IO::Socket::IP"
"sudo cpan JSON::WebToken"
on my Ubuntu Mint 17.2 installation to get a clean read on the Perl Modules list. This is based on Ubuntu 14 LTS

Modules version list:
Mail::IMAPClient 3.35
IO::Socket 1.36
IO::Socket::IP 0.37
IO::Socket::INET 1.33
IO::Socket::SSL 1.965
Net::SSLeay 1.58
Compress::Zlib 2.063
Digest::MD5 2.52
Digest::HMAC_MD5 1.01
Digest::HMAC_SHA1 1.03
Term::ReadKey 2.31
File::Spec 3.40
Time::HiRes 1.9725
Unicode::String 2.09
IO::Tee 0.64
File::Copy::Recursive 0.38
Authen::NTLM 1.09
URI::Escape 3.31
Data::Uniqid 0.12
JSON::WebToken 0.10
( use --no-modules_version to turn off printing this Perl modules list )

Password Starting $

If your password starts with $ it will say output:

Option password2 requires an argument

Perl warning about uninitialized variables

Using imapsync v1.569 commit 8f266ab, on a Debian squeeze system using libmail-imapclient-perl 3.31-2:

Host1 separator and prefix: [.][INBOX.]
Host2 separator and prefix: [.][]
++++ Calculating sizes on Host1
Host1 folder [INBOX]

Use of uninitialized value in hash element at /usr/share/perl5/Mail/IMAPClient.pm line 2252.
Use of uninitialized value $size in addition (+) at ./imapsync line 2845.
Use of uninitialized value $list[1] in sort at ./imapsync line 1790.
Use of uninitialized value $list[1] in sort at ./imapsync line 1790.
Use of uninitialized value $list[0] in sort at ./imapsync line 1790.
Use of uninitialized value $list[0] in sort at ./imapsync line 1790.
Size: 1878559958 Messages: 82928 Biggest: 15513754

Trying to do oauth2 with Google Apps

Hi,

I've tried used IMAPSYNC with oauth2. I've set up the OAUTH2 consumer key/password in google developer console and made a service app for it.
I still get an error:

Undefined subroutine &main::encode_entities called at ./imapsync line 2446.

Being this code snippit:

my $ua = LWP::UserAgent->new();

I have double checked LWP::UserAgent is installed via CPAN.

Here is my input command:

/imapsync --justlogin --host1 imap.gmail.com -ssl1 --authmech1 xoauth2 --user1 [email protected] --password1 '1234556789-3d08030dsdkadfklksfl2313f213213sdks42lk@developer.gserviceaccount.com;notasecret.p12' --ssl2 --host2 mail.example.com.au --user2 [email protected] --authuser2 [email protected] --password2 password

(information has been changed, but you get the idea).

Here are the Perl Modules installed:

Modules version list:
Mail::IMAPClient 3.35
IO::Socket 1.38
IO::Socket::IP 0.37
IO::Socket::INET 1.35
IO::Socket::SSL 1.965
Net::SSLeay 1.65
Compress::Zlib 2.066
Digest::MD5 2.53
Digest::HMAC_MD5 1.01
Digest::HMAC_SHA1 1.03
Term::ReadKey 2.32
File::Spec 3.48_01
Time::HiRes 1.9726
Unicode::String 2.09
IO::Tee 0.64
File::Copy::Recursive 0.38
Authen::NTLM 1.09
URI::Escape 3.31
Data::Uniqid 0.12
JSON::WebToken 0.10

This was from an Ubuntu 15.04 install. I did it on another machine, CENTOS 7. and it was the same problem. Is this the correct google API Endpoint? 'https://www.googleapis.com/oauth2/v3/token' ?

Feature request: ability to print message subject

Hello

I'd like to be able to print the messages subjects, on some logs:
For instance:

msg INBOX.Archived/95551 marked \Deleted on host2 [GyDD6WpsFEtyBzNFnv]
msg [Gmail]/All Mail/281079 copying to INBOX.Archived

It would be great to be able to print the email subject, in order to debug or to get more useful information.

Thanks

3 BAD Unexpected ')'

Just downloaded the latest version, and then amended as per:
changed calls to SSL/TLS to include the right arguments
to avoid the "SSL_verify_mode must be a number and not a string" error.

My email accounts use special characters, including the closing bracket ')'. imapsync throws the following error:
Failure: error login on [{server}] with user [{user}@{domain}] auth [LOGIN]: 3 BAD Unexpected ')'

If I change the password so it doesn't include the closing bracket then it works OK.

I've tried escaping the special character and / or quoting the password but to no avail.

Am I doing something wrong, or does this need a code change? Cheers.

Uninitialized value in hash element

During a sync with git HEAD imapsync I am getting the Perl warning:

...
Subscribing to folder INBOX on destination server
Use of uninitialized value in hash element at /usr/share/perl5/Mail/IMAPClient.pm line 2217, <GEN2> line 1.

This might be nothing but it's always worth understanding what's happening. Can I provide further debug info or is this enough for you to find out what's going on?

Cheers.

--f1f2 str1=str2 without effect

Hi,
tried to sync mails from IMAP (courier) to SBS 2011 (Exchange 2010) with the following options:

--f1f2 Drafts='Entw&APw-rfe'
--f1f2 Junk='Junk-E-Mail'
--f1f2 Sent='Gesendete Elemente'
--f1f2 Trash='Gel&APY-schte Elemente'

... imapsync (1.670) is showing the following remapping

Folders mapping from --f1f2 options, it overrides --automap:
[Trash] -> [Gel&APY-schte Elemente] = [Gelöschte Elemente]
[Sent] -> [Gesendete Elemente]
[Drafts] -> [Entw&APw-rfe] = [Entwürfe]
[Junk] -> [Junk-E-Mail]

... but is ignoring them and creating the missing folders instead of syncing to mapped folders as wanted with the --f1f2 option

++++ Looping on each one of 5 folders to sync
1/5 [INBOX] -> [INBOX]
2/5 [INBOX.Drafts] -> [Drafts]
Creating folder [Drafts] on host2
Created folder [Drafts] on host2
3/5 [INBOX.Junk] -> [Junk]
Creating folder [Junk] on host2
Created folder [Junk] on host2
4/5 [INBOX.Sent] -> [Sent]
Creating folder [Sent] on host2
Created folder [Sent] on host2
msg INBOX.Sent/2 {406} copied to Sent/1 0.74 msgs/s 0.292 KiB/s 0.396 KiB copied ETA: Thu Dec 17 13:55:36 2015 0 s 0/1 msgs left
5/5 [INBOX.Trash] -> [Trash]
Creating folder [Trash] on host2
Created folder [Trash] on host2
++++ End looping on each folder

warning/error message if "--sep2 /" is used

Hello
first of all thanks for this great piece of software!
We already migrated a lot of mailboxes from zimbra to O365 without any problem, also with admin delegated access.

After checking login infos, it usually says:

Host1: separator given by NAMESPACE: [/]
Host2: separator given by NAMESPACE: [/]
Host1: prefix given by NAMESPACE: []
Host2: prefix given by NAMESPACE: []
Host1 separator and prefix: [/][]
Host2 separator and prefix: [/][]

These days, only on certain domains, it started saying this:

Host1: separator given by NAMESPACE: [/]
Host2: NAMESPACE request failed for outlook.office365.com: * BYE Connection closed. 14; 11 BAD User is authenticated but not connected.
Give the separator character with the --sep2 option,
the folowing listing of folders may help you to find it:
Most of the time it is character . or /
so try --sep2 . or --sep2 /

Said that I have no idea of the cause of that message about NAMESPACE on host2 (O365), we tried option "--sep2 /" as imapsync suggests.
It seems to work about NAMESPACE, but it gives these warnings

Use of uninitialized value $h2_prefix in string eq at /root/imapsync/imapsync line 3091.
Use of uninitialized value $h2_prefix in concatenation (.) or string at /root/imapsync/imapsync line 3091.

Please find below the full output (domains and email are masked)

Transfer started at Fri Jun  5 12:55:33 2015
PID is 22378
Log file is LOG_imapsync/[email protected]  ( to change it, use --logfile filepath ; or use --nolog to turn off logging )
$RCSfile: imapsync,v $ $Revision: 1.637 $ $Date: 2015/04/01 01:36:37 $
Here is a [linux] system (Linux zmta01.domain.com 2.6.32-74-server #142-Ubuntu SMP Tue Apr 28 10:12:19 UTC 2015 x86_64)
With perl 5.10.1 Mail::IMAPClient  3.35
Command line used:
imapsync/imapsync --dry --justfolders --nofoldersizes --buffersize 8192000 --nosyncacls --syncinternaldates --exclude Chats|Contacts|Emailed Contacts|Junk|Problemi di sincronizzazione|Trash|^Rubrica --useheader Message-Id --noauthmd5 --skipsize --host1 posta.domain.com --user1 [email protected] --authuser1 [email protected] --password1 MASKED --authmech1 PLAIN --host2 outlook.office365.com --user2 [email protected] --authuser2 [email protected] --password2 MASKED --ssl2 --port2 993 --regextrans2 s#Sent#Posta inviata# --regextrans2 s#Drafts#Bozze# --sep2 /
Temp directory is /tmp  ( to change it use --tmpdir dirpath )
PID file is /tmp/imapsync.pid ( to change it use --pidfile filepath ; to avoid it use --pidfile "" )
Modules version list:
Mail::IMAPClient     3.35
IO::Socket           1.31
IO::Socket::IP       ?
IO::Socket::INET     1.31
IO::Socket::SSL      1.31
Net::SSLeay          1.35
Compress::Zlib       2.02
Digest::MD5          2.39
Digest::HMAC_MD5     1.01
Digest::HMAC_SHA1    1.01
Term::ReadKey        2.30
File::Spec           3.3
Time::HiRes          1.9719
Unicode::String      2.09
IO::Tee              0.64
File::Copy::Recursive 0.38
Authen::NTLM         ?
URI::Escape          3.29
Data::Uniqid         ?
( use --no-modules_version to turn off printing this Perl modules list )
Info: turned ON syncinternaldates, will set the internal dates (arrival dates) on host2 same as host1.
Info: will try to use PLAIN authentication on host1
Info: will try to use PLAIN authentication on host2
Info: imap connexions timeout is 120 seconds
Host1: IMAP server [posta.domain.com] port [143] user [[email protected]]
Host2: IMAP server [outlook.office365.com] port [993] user [[email protected]]
Host1: * OK IMAP4 ready
Host1: posta.domain.com says it has CAPABILITY for AUTHENTICATE PLAIN
Host1: success login on [posta.domain.com] with user [[email protected]] auth [PLAIN]
Host2: * OK The Microsoft Exchange IMAP4 service is ready. [VgBJADEAUABSADAAOQBDAEEAMAAwADQAMQAuAGUAdQByAHAAcgBkADAAOQAuAHAAcgBvAGQALgBvAHUAdABsAG8AbwBrAC4AYwBvAG0A]
Host2: outlook.office365.com says it has CAPABILITY for AUTHENTICATE PLAIN
Host2: success login on [outlook.office365.com] with user [[email protected]] auth [PLAIN]
Host1: state Authenticated
Host2: state Authenticated
Host1 capability: IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST
Host2 capability: IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CLIENTACCESSRULES CHILDREN IDLE NAMESPACE LITERAL+
Excluding folders matching pattern Chats|Contacts|Emailed Contacts|Junk|Problemi di sincronizzazione|Trash|^Rubrica
[Chats]
[Contacts]
[Emailed Contacts]
[Junk]
[Trash]

Host1: separator given by NAMESPACE: [/]
Host2: NAMESPACE request failed but using [/] given by --sep2
Host1: prefix given by NAMESPACE: []
Use of uninitialized value $prefix_out in concatenation (.) or string at imapsync/imapsync line 3120.
Host2: prefix given by NAMESPACE: []
Host1 separator and prefix: [/][]
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 1283.
Host2 separator and prefix: [/][]
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.

++++ Listing folders
All foldernames are presented between brackets like [X] where X is the foldername.
When a foldername contains non-ASCII characters it is presented in the form
[X] = [Y] where
X is the imap foldername you have to use in command line options and
Y is the uft8 output just printed for convenience, to recognize it.

Host1 folders list:
[Chats]
[Contacts]
[Drafts]
[Emailed Contacts]
[INBOX]
[Junk]
[Posta eliminata]
[Posta indesiderata]
[Posta inviata]
[Sent]
[Trash]

Host2 folders list:

++++ Looping on each folder
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
[Drafts]                            -> [Bozze]
Creating folder [Bozze] on host2
Created  folder [Bozze] on host2        (not really since --dry mode)
Since --dry mode is on and folder [Bozze] on host2 does not exist yet, syncing messges will not be simulated.
To simulate message syncing, use --justfolders without --dry to first create the missing folders then rerun the --dry sync.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
[INBOX]                             -> [INBOX]
Creating folder [INBOX] on host2
Created  folder [INBOX] on host2        (not really since --dry mode)
Since --dry mode is on and folder [INBOX] on host2 does not exist yet, syncing messges will not be simulated.
To simulate message syncing, use --justfolders without --dry to first create the missing folders then rerun the --dry sync.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
[Posta eliminata]                   -> [Posta eliminata]
Creating folder [Posta eliminata] on host2
Created  folder [Posta eliminata] on host2      (not really since --dry mode)
Since --dry mode is on and folder [Posta eliminata] on host2 does not exist yet, syncing messges will not be simulated.
To simulate message syncing, use --justfolders without --dry to first create the missing folders then rerun the --dry sync.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
[Posta indesiderata]                -> [Posta indesiderata]
Creating folder [Posta indesiderata] on host2
Created  folder [Posta indesiderata] on host2   (not really since --dry mode)
Since --dry mode is on and folder [Posta indesiderata] on host2 does not exist yet, syncing messges will not be simulated.
To simulate message syncing, use --justfolders without --dry to first create the missing folders then rerun the --dry sync.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
[Posta inviata]                     -> [Posta inviata]
Creating folder [Posta inviata] on host2
Created  folder [Posta inviata] on host2        (not really since --dry mode)
Since --dry mode is on and folder [Posta inviata] on host2 does not exist yet, syncing messges will not be simulated.
To simulate message syncing, use --justfolders without --dry to first create the missing folders then rerun the --dry sync.
Use of uninitialized value $h2_prefix in string eq at imapsync/imapsync line 3349.
Use of uninitialized value $h2_prefix in concatenation (.) or string at imapsync/imapsync line 3349.
[Sent]                              -> [Posta inviata]
Creating folder [Posta inviata] on host2
Created  folder [Posta inviata] on host2        (not really since --dry mode)
Since --dry mode is on and folder [Posta inviata] on host2 does not exist yet, syncing messges will not be simulated.
To simulate message syncing, use --justfolders without --dry to first create the missing folders then rerun the --dry sync.
++++ End looping on each folder
++++ Statistics
Transfer started on               : Fri Jun  5 12:55:33 2015
Transfer ended on                 : Fri Jun  5 12:55:43 2015
Transfer time                     : 10.2 sec
Messages transferred              : 0 (could be 0 without dry mode)
Messages skipped                  : 0
Messages found duplicate on host1 : 0
Messages found duplicate on host2 : 0
Messages void (noheader) on host1 : 0
Messages void (noheader) on host2 : 0
Messages deleted on host1         : 0
Messages deleted on host2         : 0
Total bytes transferred           : 0 (0.000 KiB)
Total bytes duplicate host1       : 0 (0.000 KiB)
Total bytes duplicate host2       : 0 (0.000 KiB)
Total bytes skipped               : 0 (0.000 KiB)
Total bytes error                 : 0 (0.000 KiB)
Message rate                      : 0.0 messages/s
Average bandwidth rate            : 0.0 KiB/s
Reconnections to host1            : 0
Reconnections to host2            : 0
Memory consumption                : 99.6 MiB
Biggest message                   : 0 bytes
Detected 0 errors


Homepage: http://imapsync.lamiral.info/
Log file is LOG_imapsync/[email protected]  ( to change it, use --logfile filepath ; or use --nolog to turn off logging )

Copying "sent messages", "Sender" is empty

I'm copying two folders using imapsync; one regular folder, which copies over perfectly, and one where I copy Sent Messages (from Exchange IMAP) to [Gmail]Sent Mail (GMail). In the second case, where I am the sender, the messages are copied over but there's no sender in the copied message. Would it be possible to specify a default sender if it is empty?

Folders sync but all messages fail

I'm not really sure what is wrong here, below is what the log shows. I've attempted it multiple times with and without SSL switched on for the second server. The second server is new and the folder thus completely empty. The folders were created during the first attempt, but all messages failed on each attempt.

I removed some info like domainnames, IPs and full username. I am willing to send you the unedited version if that might help.

Transfer started at Sun Aug 10 04:06:25 2014
PID is 9388
Log file is LOG_imapsync/[email protected]
$RCSfile: imapsync,v $ $Revision: 1.592 $ $Date: 2014/05/22 10:03:17 $ 
Here is a [MSWin32] system (Windows NT PC 6.2 Build 9200 x86)
With perl 5.16.3 Mail::IMAPClient  3.35
Command line used:
D:\...\imapsync_1.592\imapsync.exe --host1 xx.xx.xx.xx --user1 [email protected] --password1 MASKED --host2 .....nl --ssl2 --user2 [email protected] --password2 MASKED
Temp directory is C:\Users\...\AppData\Local\Temp
PID file is C:\Users\...\AppData\Local\Temp/imapsync.pid
Modules version list:
Mail::IMAPClient     3.35
IO::Socket           1.31
IO::Socket::IP       0.29
IO::Socket::INET     1.31
IO::Socket::SSL      1.991
Net::SSLeay          1.63
Digest::MD5          2.53
Digest::HMAC_MD5     1.01
Digest::HMAC_SHA1    1.03
Term::ReadKey        2.30.02
Authen::NTLM         1.09
File::Spec           3.40
Time::HiRes          1.9725
URI::Escape          3.31
Data::Uniqid         0.12

Info: turned ON syncinternaldates, will set the internal dates (arrival dates) on host2 same as host1.
Info: will try to use LOGIN authentication on host1
Info: will try to use LOGIN authentication on host2
Info: imap connexions timeout is 120 seconds
Host1: IMAP server [xx.xx.xx.xx] port [143] user [[email protected]]
Host2: IMAP server [....nl] port [993] user [[email protected]]
Host1: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN AUTH=DIGEST-MD5 AUTH=CRAM-MD5] Dovecot ready.

Host1: xx.xx.xx.xx says it has CAPABILITY for AUTHENTICATE LOGIN
Host1: success login on [xx.xx.xx.xx] with user [[email protected]] auth [LOGIN]
Host2: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot DA ready.

Host2: ....nl says it has NO CAPABILITY for AUTHENTICATE LOGIN
Host2: success login on [....nl] with user [[email protected]] auth [LOGIN]
Host1: state Authenticated
Host2: state Authenticated
Host1 capability: IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS
Host2 capability: IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY MOVE
Host1: separator given by NAMESPACE: [/]
Host2: separator given by NAMESPACE: [.]
Host1: prefix given by NAMESPACE: []
Host2: prefix given by NAMESPACE: []
Host1 separator and prefix: [/][]
Host2 separator and prefix: [.][]
++++ Calculating sizes on Host1
Host1 folder [.procmailrc]                       Size:         0 Messages:     0 Biggest:         0
Host1 folder [Clienten]                          Size:      2054 Messages:     1 Biggest:      2054
Host1 folder [Drafts]                            Size:         0 Messages:     0 Biggest:         0
Host1 folder [INBOX]                             Size:     26848 Messages:     2 Biggest:     13713
Host1 folder [INBOX.Drafts]                      Size:         0 Messages:     0 Biggest:         0
Host1 folder [INBOX.Sent]                        Size:         0 Messages:     0 Biggest:         0
Host1 folder [INBOX.Trash]                       Size:         0 Messages:     0 Biggest:         0
Host1 folder [Praktijk overig]                   Size:         0 Messages:     0 Biggest:         0
Host1 folder [Sent]                              Size:    553037 Messages:     6 Biggest:    315784
Host1 folder [Spam]                              Size:         0 Messages:     0 Biggest:         0
Host1 folder [Trash]                             Size:     38611 Messages:    21 Biggest:      6398
Host1 folder [mbox]                              Size:     26848 Messages:     2 Biggest:     13713
Host1 Nb messages:              32 messages
Host1 Total size:           647398 bytes (632.225 KiB)
Host1 Biggest message:      315784 bytes (308.383 KiB)
Host1 Time spent:              4.6 seconds
++++ Calculating sizes on Host2
Host2 folder [Clienten]                          Size:         0 Messages:     0 Biggest:         0
Host2 folder [Drafts]                            Size:         0 Messages:     0 Biggest:         0
Host2 folder [INBOX]                             Size:         0 Messages:     0 Biggest:         0
Host2 folder [INBOX_Drafts]                      Size:         0 Messages:     0 Biggest:         0
Host2 folder [INBOX_Sent]                        Size:         0 Messages:     0 Biggest:         0
Host2 folder [INBOX_Trash]                       Size:         0 Messages:     0 Biggest:         0
Host2 folder [Praktijk overig]                   Size:         0 Messages:     0 Biggest:         0
Host2 folder [Sent]                              Size:         0 Messages:     0 Biggest:         0
Host2 folder [Spam]                              Size:         0 Messages:     0 Biggest:         0
Host2 folder [Trash]                             Size:         0 Messages:     0 Biggest:         0
Host2 folder [_procmailrc]                       Size:         0 Messages:     0 Biggest:         0
Host2 folder [mbox]                              Size:         0 Messages:     0 Biggest:         0
Host2 Nb messages:               0 messages
Host2 Total size:                0 bytes (0.000 KiB)
Host2 Biggest message:           0 bytes (0.000 KiB)
Host2 Time spent:              0.8 seconds
++++ Listing folders
Host1 folders list:
[.procmailrc]
[Clienten]
[Drafts]
[INBOX]
[INBOX.Drafts]
[INBOX.Sent]
[INBOX.Trash]
[Praktijk overig]
[Sent]
[Spam]
[Trash]
[mbox]

Host2 folders list:
[Clienten]
[Drafts]
[INBOX]
[INBOX_Drafts]
[INBOX_Sent]
[INBOX_Trash]
[Praktijk overig]
[Sent]
[Spam]
[Trash]
[_procmailrc]
[mbox]

Folders in host2 not in host1:

++++ Looping on each folder
[.procmailrc]                       -> [_procmailrc]                      
[Clienten]                          -> [Clienten]                         
- msg Clienten/1 {0} S[2054] F[\Seen] I[23-Feb-2011 20:04:38 +0100] could not be fetched: socket closed while reading data from server (4x)
- msg Clienten/1 skipped. Could not be fetched
[Drafts]                            -> [Drafts]                           
[INBOX]                             -> [INBOX]                            
- msg INBOX/9894 {0} S[13135] F[] I[09-Aug-2014 23:05:10 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg INBOX/9894 skipped. Could not be fetched
- msg INBOX/9895 {0} S[13713] F[] I[10-Aug-2014 01:00:26 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg INBOX/9895 skipped. Could not be fetched
[INBOX.Drafts]                      -> [INBOX_Drafts]                     
[INBOX.Sent]                        -> [INBOX_Sent]                       
[INBOX.Trash]                       -> [INBOX_Trash]                      
[Praktijk overig]                   -> [Praktijk overig]                  
[Sent]                              -> [Sent]                             
- msg Sent/1 {0} S[2616] F[\Seen] I[03-Mar-2011 19:13:29 +0100] could not be fetched: socket closed while reading data from server (4x)
- msg Sent/1 skipped. Could not be fetched
- msg Sent/2 {0} S[39496] F[\Seen] I[18-Jul-2011 19:18:14 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Sent/2 skipped. Could not be fetched
- msg Sent/3 {0} S[41754] F[\Seen] I[18-Jul-2011 19:48:18 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Sent/3 skipped. Could not be fetched
- msg Sent/4 {0} S[315784] F[\Seen] I[12-Aug-2011 21:02:57 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Sent/4 skipped. Could not be fetched
- msg Sent/5 {0} S[145565] F[\Seen] I[15-Aug-2011 21:42:30 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Sent/5 skipped. Could not be fetched
- msg Sent/6 {0} S[7822] F[\Seen] I[09-Sep-2011 20:42:05 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Sent/6 skipped. Could not be fetched
[Spam]                              -> [Spam]                             
[Trash]                             -> [Trash]                            
- msg Trash/1 {0} S[3130] F[\Seen] I[14-Jul-2011 11:25:44 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/1 skipped. Could not be fetched
- msg Trash/2 {0} S[1627] F[] I[15-Jul-2011 23:12:25 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/2 skipped. Could not be fetched
- msg Trash/3 {0} S[1148] F[] I[15-Jul-2011 09:30:01 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/3 skipped. Could not be fetched
- msg Trash/4 {0} S[1166] F[] I[13-Jul-2011 12:24:36 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/4 skipped. Could not be fetched
- msg Trash/5 {0} S[1148] F[] I[13-Jul-2011 12:23:52 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/5 skipped. Could not be fetched
- msg Trash/6 {0} S[1166] F[] I[13-Jul-2011 12:47:13 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/6 skipped. Could not be fetched
- msg Trash/7 {0} S[1152] F[] I[13-Jul-2011 17:17:59 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/7 skipped. Could not be fetched
- msg Trash/8 {0} S[1170] F[] I[13-Jul-2011 17:20:13 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/8 skipped. Could not be fetched
- msg Trash/9 {0} S[1168] F[] I[13-Jul-2011 17:20:39 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/9 skipped. Could not be fetched
- msg Trash/10 {0} S[2594] F[\Seen] I[13-Jul-2011 19:07:47 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/10 skipped. Could not be fetched
- msg Trash/11 {0} S[1625] F[] I[19-Jul-2011 19:53:23 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/11 skipped. Could not be fetched
- msg Trash/12 {0} S[1625] F[] I[19-Jul-2011 20:04:29 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/12 skipped. Could not be fetched
- msg Trash/13 {0} S[1625] F[] I[19-Jul-2011 20:06:26 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/13 skipped. Could not be fetched
- msg Trash/14 {0} S[1642] F[] I[19-Jul-2011 20:07:21 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/14 skipped. Could not be fetched
- msg Trash/15 {0} S[1627] F[] I[31-Jul-2011 15:25:41 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/15 skipped. Could not be fetched
- msg Trash/16 {0} S[1149] F[] I[30-Jul-2011 19:11:50 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/16 skipped. Could not be fetched
- msg Trash/17 {0} S[1180] F[] I[11-Aug-2011 18:26:04 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/17 skipped. Could not be fetched
- msg Trash/18 {0} S[1162] F[] I[11-Aug-2011 18:24:59 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/18 skipped. Could not be fetched
- msg Trash/19 {0} S[1180] F[] I[11-Aug-2011 18:17:02 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/19 skipped. Could not be fetched
- msg Trash/20 {0} S[3929] F[] I[12-Aug-2011 20:00:51 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/20 skipped. Could not be fetched
- msg Trash/21 {0} S[6398] F[\Seen] I[11-Aug-2011 17:12:52 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg Trash/21 skipped. Could not be fetched
[mbox]                              -> [mbox]                             
- msg mbox/9894 {0} S[13135] F[] I[09-Aug-2014 23:05:10 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg mbox/9894 skipped. Could not be fetched
- msg mbox/9895 {0} S[13713] F[] I[10-Aug-2014 01:00:26 +0200] could not be fetched: socket closed while reading data from server (4x)
- msg mbox/9895 skipped. Could not be fetched
++++ End looping on each folder
++++ Calculating sizes on Host1
Host1 folder [.procmailrc]                       Size:         0 Messages:     0 Biggest:         0
Host1 folder [Clienten]                          Size:      2054 Messages:     1 Biggest:      2054
Host1 folder [Drafts]                            Size:         0 Messages:     0 Biggest:         0
Host1 folder [INBOX]                             Size:     26848 Messages:     2 Biggest:     13713
Host1 folder [INBOX.Drafts]                      Size:         0 Messages:     0 Biggest:         0
Host1 folder [INBOX.Sent]                        Size:         0 Messages:     0 Biggest:         0
Host1 folder [INBOX.Trash]                       Size:         0 Messages:     0 Biggest:         0
Host1 folder [Praktijk overig]                   Size:         0 Messages:     0 Biggest:         0
Host1 folder [Sent]                              Size:    553037 Messages:     6 Biggest:    315784
Host1 folder [Spam]                              Size:         0 Messages:     0 Biggest:         0
Host1 folder [Trash]                             Size:     38611 Messages:    21 Biggest:      6398
Host1 folder [mbox]                              Size:     26848 Messages:     2 Biggest:     13713
Host1 Nb messages:              32 messages
Host1 Total size:           647398 bytes (632.225 KiB)
Host1 Biggest message:      315784 bytes (308.383 KiB)
Host1 Time spent:              1.1 seconds
++++ Calculating sizes on Host2
Host2 folder [Clienten]                          Size:         0 Messages:     0 Biggest:         0
Host2 folder [Drafts]                            Size:         0 Messages:     0 Biggest:         0
Host2 folder [INBOX]                             Size:         0 Messages:     0 Biggest:         0
Host2 folder [INBOX_Drafts]                      Size:         0 Messages:     0 Biggest:         0
Host2 folder [INBOX_Sent]                        Size:         0 Messages:     0 Biggest:         0
Host2 folder [INBOX_Trash]                       Size:         0 Messages:     0 Biggest:         0
Host2 folder [Praktijk overig]                   Size:         0 Messages:     0 Biggest:         0
Host2 folder [Sent]                              Size:         0 Messages:     0 Biggest:         0
Host2 folder [Spam]                              Size:         0 Messages:     0 Biggest:         0
Host2 folder [Trash]                             Size:         0 Messages:     0 Biggest:         0
Host2 folder [_procmailrc]                       Size:         0 Messages:     0 Biggest:         0
Host2 folder [mbox]                              Size:         0 Messages:     0 Biggest:         0
Host2 Nb messages:               0 messages
Host2 Total size:                0 bytes (0.000 KiB)
Host2 Biggest message:           0 bytes (0.000 KiB)
Host2 Time spent:              0.9 seconds
++++ Statistics
Transfer started on               : Sun Aug 10 04:06:25 2014
Transfer ended on                 : Sun Aug 10 04:06:57 2014
Transfer time                     : 32.0 sec
Messages transferred              : 0 
Messages skipped                  : 32
Messages found duplicate on host1 : 0
Messages found duplicate on host2 : 0
Messages void (noheader) on host1 : 0
Messages void (noheader) on host2 : 0
Messages deleted on host1         : 0
Messages deleted on host2         : 0
Total bytes transferred           : 0 (0.000 KiB)
Total bytes duplicate host1       : 0 (0.000 KiB)
Total bytes duplicate host2       : 0 (0.000 KiB)
Total bytes skipped               : 647398 (632.225 KiB)
Total bytes error                 : 647398 (632.225 KiB)
Message rate                      : 0.0 messages/s
Average bandwidth rate            : 0.0 KiB/s
Reconnections to host1            : 0
Reconnections to host2            : 0
Memory consumption                : 33.7 MiB
Biggest message                   : 0 bytes
Initial difference host2 - host1  : -32 messages, -647398 bytes (-632.225 KiB)
Final   difference host2 - host1  : -32 messages, -647398 bytes (-632.225 KiB)
Detected 32 errors

This current imapsync is up to date
Homepage: http://imapsync.lamiral.info/
Log file is LOG_imapsync/[email protected]

Possible to delete messages using pipemess?

Is there a way to have the pipemess script signal that I don't want to copy an individual message, but I do want it deleted on the source end? Our work printing system uses print-by-email so I have a lot of messages to [email protected], and I'd rather just delete them while I archive the rest of my mail.

folder with whitespaces

I am trying to migrate Exchange folders (in german language). Somehow I am unable to get it working. I tried these combinations:

--regextrans2 s/Gel&APY-schte Objekte/Trash/
--regextrans2 s/(Gel&APY-schte Objekte)/Trash/
--regextrans2 s/Gelöschte Objekte/Trash/
--regextrans2 s/^Gelöschte Objekte$/Trash/

on most runs i get following error message:

error: eval regextrans2: Substitution pattern not terminated

if I chose

--regextrans2 s/$Gelöschte/Trash/

it results on host1 to "Trash Objekte" - not exactly what I am expecting....

what am I doing wrong ? What is the correct, working to get it working ?

Regards
Peter

Upon certificate issues, STARTTLS is ignored and the password sent in plaintext

Currently there seems to be no STARTTLS support in imapsync, is that correct? --tls1/2 on my system still results in (excerpt from output):

Info: will try to use LOGIN authentication on host1
Host1: IMAP server [$HOST1] port [$PORT1] user [$USER1]
Host1: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS LOGINDISABLED] Dovecot ready.
Host1: $HOST1 says it has NO CAPABILITY for AUTHENTICATE LOGIN
Failure: error login on [$HOST1] with user [$USER1] auth [LOGIN]: 4 NO [PRIVACYREQUIRED] Plaintext authentication disallowed on non-secure (SSL/TLS) connections.

support for perl threads

my mailbox with ~20k msg's is taking hours to complete.
no idea what changed from 1.3x -> 1.5x but it is way slower.

In my opinion perl threads would/could be useful to fasten things up?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.