Coder Social home page Coder Social logo

imapsync / imapsync Goto Github PK

View Code? Open in Web Editor NEW
3.2K 88.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 Issues

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.

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-]
…

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.

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.

"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

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

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

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');

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?

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.

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

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

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' ?

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

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 :)

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?

--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

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

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.

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.

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.

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

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]

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

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?

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.

"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

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

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 )

Password Starting $

If your password starts with $ it will say output:

Option password2 requires an argument

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

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

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!

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

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 )

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 )

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.

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.

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.

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. :(

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

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  ?

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 :)

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 :)

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.

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

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.