I don't really know Perl and I wasn't sure on the origins of the variable named $string that's why I created my own named $mmstr
Printable View
good catch. you also have to uncomment this line:
Code:#my $string = $from->message_string($f_msg);
First of all, in my case, the lines this section of the coding was on was different, not 1123. It may be different for other people as well so be aware of this. Second, the ONLY way I could get this to work is if I made that section look EXACTLY like what marcdm had posted. Hope that helps. I wouldn't try anything else if you want this to work, just make it look exactly like marcdm's last post.
Thanks for that bit of info marcdm, helped me out a lot.
I tried Bobby's solution, worked a treat.
Changed
to thisCode:#my $string = $from->message_string($f_msg);
and changedCode:my $string = $from->message_string($f_msg);
to thisCode:
#unless($new_id = $to->append_string($t_fold,$string, $flags_f, $d)){
unless($new_id = $to->append_file($t_fold, $message_file, $flags_f, $d)){
Code:
unless($new_id = $to->append_string($t_fold,$string, $flags_f, $d)){
#unless($new_id = $to->append_file($t_fold, $message_file, $flags_f, $d)){
Or for the geeks in the audience, here's a patch:
Code:# diff -u /usr/bin/imapsync.orig /usr/bin/imapsync
--- /usr/bin/imapsync.orig 2007-01-26 17:18:13.000000000 -0500
+++ /usr/bin/imapsync 2007-01-26 17:33:34.000000000 -0500
@@ -1078,7 +1078,7 @@
# copy
print "+ Copying msg #$f_msg:$f_size to folder $t_fold\n";
last FOLDER if $from->IsUnconnected();
- #my $string = $from->message_string($f_msg);
+ my $string = $from->message_string($f_msg);
my $message_file = "tmp_imapsync_$$";
unlink($message_file);
$from->message_to_file($message_file, $f_msg);
@@ -1111,8 +1111,8 @@
print "flags from : [$flags_f][$d]\n";
last FOLDER if $to->IsUnconnected();
unless ($dry) {
- #unless($new_id = $to->append_string($t_fold,$string, $flags_f, $d)){
- unless($new_id = $to->append_file($t_fold, $message_file, $flags_f, $d)){
+ unless($new_id = $to->append_string($t_fold,$string, $flags_f, $d)){
+ #unless($new_id = $to->append_file($t_fold, $message_file, $flags_f, $d)){
warn "Couldn't append msg #$f_msg (Subject:[".$from->subject($f_msg)."]) to folder $t_fold: ",
$to->LastError, "\n";
$error++;
Hi,
I changed the above lines in my imapsync, i get the following error while syncing
+ NO msg #70 [mjmLeWsKuCobPVWzqs4BUQ:172] in Inbox
+ Copying msg #70:172 to folder Inbox
Mail::IMAPClient=HASH(0x9457e48)::message_string: expected 172 bytes but received 1574 at /usr/bin/imapsync line 1081
flags from : [\Seen]["28-Sep-2005 03:55:19 +0000"]
Copied msg id [70] to folder Inbox msg id [440]
+ NO msg #73 [D6W9P5sVrTdBvRJdZ0LP4g:172] in Inbox
+ Copying msg #73:172 to folder Inbox
Mail::IMAPClient=HASH(0x9457e48)::message_string: expected 172 bytes but received 1588 at /usr/bin/imapsync line 1081
Because of this attachments are not being synced properly,
thanks,
Sunil
Hi.
The imapsync documentation is pretty good.
You're missing an option it seems.
Here's the line that worked the way I needed it to. I believe you're just missing the --skipsizes option.
Please be aware that the below line will not work as-is for you. You'd have to understand and change everything, including realising that all the mail will keep the folder-structure of your source, but that it will all be created in a subfolder from the root.
The above example also assumes your folders are set up to be separated by the UNIX separator ('/') on the destination machine and not dots. Zimbra's (the machine you're likely transferring to -- the destination's) default appears to be /. imapsync should take care of recognizing dotted or "slashed" folder separators on the source without you needing to do anything.Code:imapsync --regextrans2 's/(.*)/importedmail\/$1/' --nosyncacls --syncinternaldates --authmech1 PLAIN --ssl1 --authmech2 PLAIN --ssl2 --host1 source.domain.tld --user1 myusername --password1 "long long password" --host2 destination.zimbraenabled.otherdomain.tld --user2 myusername --password2 shortpassword --skipsize --nofoldersizes 2>1 | tee imapsync.log
Hi Miz,
I tried adding the options you told "--skipsize --nofoldersizes" but am still getting the same error, this is after i add the above mentioned lines in /usr/bin/imapsync. If i remove those lines it doesn't throw up the error but the dates get messed up.
Am pasting my imapsync script that i use..
imapsync $1 --nosyncacls --skipsize --nofoldersizes --syncinternaldates --authmech1 PLAIN --authmech2 PLAIN --ssl2 \
--exclude "#KnownSpam" --exclude "#FalsePositives" \
--exclude "Trash" --exclude "Deleted Items" \
--exclude "Deleted Messages" --exclude "Deleted" \
--host1 $host1 --user1 "$user" --password1 "$p1" \
--host2 $host2 --user2 "$user2" --password2 "$p2" | tee imapsync.log
error thrown is
+ NO msg #163 [Ls+xAHKt5FyPxNpNHbBBPQ] in Inbox
+ Copying msg #163:171 to folder Inbox
Mail::IMAPClient=HASH(0x8f3ae48)::message_string: expected 171 bytes but received 1157478 at /usr/bin/imapsync line 1081
flags from : [\Seen]["08-Mar-2006 19:00:32 +0000"]
Copied msg id [163] to folder Inbox msg id [309]
Don't use imapsync version 1.200 or later unless you've applied the patch from earlier in the thread. Earlier versions should work fine.
What, the exact same message? Does it always fail on the same message? What happens if you move that message out of the way? Have you tried an earlier version of imapsync?
:confused: That's why people are doing their best to help you.