This commit is contained in:
Nick Bebout 2011-03-12 02:43:43 +00:00
parent 7876dbe7a4
commit e3723130d5
9 changed files with 109 additions and 37 deletions

View file

@ -4,7 +4,7 @@
imapsync - synchronize mailboxes between two imap servers.
$Revision: 1.7 $
$Revision: 1.10 $
=head1 INSTALL
@ -120,7 +120,7 @@ Report any bugs to the author: lamiral@linux-france.org
None known.
Feedback will be welcome.
$Id: imapsync,v 1.7 2003/03/15 03:40:54 gilles Exp gilles $
$Id: imapsync,v 1.10 2003/05/05 22:37:48 gilles Exp $
=cut
@ -145,7 +145,7 @@ my(
use vars qw ($opt_G); # missing code for this will be option.
$rcs = ' $Id: imapsync,v 1.7 2003/03/15 03:40:54 gilles Exp gilles $ ';
$rcs = ' $Id: imapsync,v 1.10 2003/05/05 22:37:48 gilles Exp $ ';
$rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1 : "UNKNOWN";
$error=0;
@ -193,18 +193,35 @@ $to = Mail::IMAPClient->new( Server => $host2,
Debug => 0,)
or die "can't open imap connection on [$host2] with user [$user2]\n";
my @f_folders = (scalar(@folder)) ? @folder : @{$from->folders()};
my @f_folders;
# @f_folders = (scalar(@folder)) ? @folder : @{$from->folders()};
if (scalar(@folder)) {
# folders are given as argument.
foreach my $f_fold (@folder) {
push (@f_folders, @{$from->folders("$f_fold", ".")});
}
}else{
# no folder given so select all
@f_folders = @{$from->folders()};
}
print "From folders : @f_folders\n";
#exit;
FOLDER: foreach my $f_fold (@f_folders) {
my $t_fold;
print "From Folder $f_fold\n";
unless ($f_fold =~ m/^INBOX/) {
$t_fold = "INBOX." . $f_fold;
}else {
# unless ($f_fold =~ m/^INBOX/) {
# $t_fold = "INBOX." . $f_fold;
# }else {
$t_fold = $f_fold;
}
# }
$t_fold =~ s@\\@\.@g;
$t_fold =~ s@\/@\.@g;
print "To Folder $t_fold\n";
unless ($from->select($f_fold)) {
warn
"From Folder $f_fold : Could not select ",
@ -427,8 +444,8 @@ Several options are mandatory.
--user2 <string> : user to login. Mandatory.
--password2 <string> : password for the user2. Dangerous, use --passfile2
--passfile2 <string> : password file for the user2. Contains the password.
--folder <string> : sync only this folder
--folder <string> : and this one.
--folder <string> : sync only this folder and its children.
--folder <string> : and this one (and its children).
--folder <string> : and this one, etc.
--delete : delete messages in "from" imap server after
a successful transfert. useful in case you