mirror of
https://github.com/imapsync/imapsync.git
synced 2025-06-06 20:55:29 +02:00
Merge 676e8af027
into 8d2730ac65
This commit is contained in:
commit
cc220896b1
5 changed files with 56 additions and 19 deletions
|
@ -170,8 +170,7 @@ imapsync \
|
||||||
--maxsleep 2 \
|
--maxsleep 2 \
|
||||||
--synclabels \
|
--synclabels \
|
||||||
--resynclabels \
|
--resynclabels \
|
||||||
--exclude "\[Gmail\]$" \
|
--folder "[Gmail]/All Mail"
|
||||||
--folderlast "[Gmail]/All Mail"
|
|
||||||
|
|
||||||
With --gmail1 --gmail2 you can override the parameters
|
With --gmail1 --gmail2 you can override the parameters
|
||||||
that are activated by them, for example:
|
that are activated by them, for example:
|
||||||
|
@ -215,8 +214,12 @@ incomprehensible alphabets, a headache for imap sysadmins.
|
||||||
See a listing here:
|
See a listing here:
|
||||||
http://stackoverflow.com/questions/2185391/localized-gmail-imap-folders/2185548#2185548
|
http://stackoverflow.com/questions/2185391/localized-gmail-imap-folders/2185548#2185548
|
||||||
|
|
||||||
--exclude "\[Gmail\]$" is just there to avoid a warning error
|
--synclabels and --resynclabels causes messages to all have the
|
||||||
when selecting this not used folder.
|
same labels on host2 as they have on host1
|
||||||
|
|
||||||
|
--folder "[Gmail]/All Mail" makes imapsync process only the All Mail
|
||||||
|
folder. Since it is syncing all labels this will sync all messages with
|
||||||
|
their correct labels.
|
||||||
|
|
||||||
Be aware that --gmail1 --gmail2 is a special case, it's not what
|
Be aware that --gmail1 --gmail2 is a special case, it's not what
|
||||||
--gmail1 does plus what --gmail2 does when they are not invoked
|
--gmail1 does plus what --gmail2 does when they are not invoked
|
||||||
|
@ -252,7 +255,9 @@ imapsync --host1 mail.oldhost.com \
|
||||||
--expunge1 \
|
--expunge1 \
|
||||||
--addheader \
|
--addheader \
|
||||||
--maxsleep 2 \
|
--maxsleep 2 \
|
||||||
|
--maxsize 35_651_584 \
|
||||||
--exclude "\[Gmail\]$" \
|
--exclude "\[Gmail\]$" \
|
||||||
|
--useheader='Message-Id'
|
||||||
--regextrans2 's,\[Gmail\].,,' \
|
--regextrans2 's,\[Gmail\].,,' \
|
||||||
--regextrans2 's,^ +| +$,,g'
|
--regextrans2 's,^ +| +$,,g'
|
||||||
--regextrans2 's,/ +| +/,/,g'
|
--regextrans2 's,/ +| +/,/,g'
|
||||||
|
@ -287,8 +292,8 @@ be 500_000_000, not 1_000_000_000, but 1GB is usually ok.
|
||||||
--maxsleep 2 is to avoid sleeping more than 2 seconds when
|
--maxsleep 2 is to avoid sleeping more than 2 seconds when
|
||||||
the --maxbytespersecond value implies a long sleep between 2 copies.
|
the --maxbytespersecond value implies a long sleep between 2 copies.
|
||||||
|
|
||||||
--maxsize 25_000_000 is mandatory since Gmail limits messages size
|
--maxsize 35_651_584 is mandatory since Gmail limits messages size
|
||||||
up to 25 MB. This value increases over time, it was 10 MB some
|
up to 35 MB. This value increases over time, it was 10 MB some
|
||||||
years ago so you can try higher values. The Gmail page about
|
years ago so you can try higher values. The Gmail page about
|
||||||
this limit is https://support.google.com/mail/answer/6584
|
this limit is https://support.google.com/mail/answer/6584
|
||||||
|
|
||||||
|
@ -301,7 +306,6 @@ marked \Deleted but deletes or moves them just after.
|
||||||
Option --expunge1 really removes messages marked \Deleted on host1
|
Option --expunge1 really removes messages marked \Deleted on host1
|
||||||
so they are not synced at all.
|
so they are not synced at all.
|
||||||
|
|
||||||
|
|
||||||
The --addheader option is there because "Sent" folder messages
|
The --addheader option is there because "Sent" folder messages
|
||||||
sometimes lack the "Message-Id:" and "Received:" headers needed
|
sometimes lack the "Message-Id:" and "Received:" headers needed
|
||||||
by imapsync to identify messages (only when --useuid is not used).
|
by imapsync to identify messages (only when --useuid is not used).
|
||||||
|
@ -313,6 +317,9 @@ the imap UID of the message on the host1 folder, like
|
||||||
"Could not examine: 43 NO [NONEXISTENT] Unknown Mailbox: [Gmail]
|
"Could not examine: 43 NO [NONEXISTENT] Unknown Mailbox: [Gmail]
|
||||||
(now in authenticated state) (Failure)".
|
(now in authenticated state) (Failure)".
|
||||||
|
|
||||||
|
--useheader='Message-Id' causes imapsync to use the Message-Id header
|
||||||
|
to uniquely identify a message for dtecting duplicates.
|
||||||
|
|
||||||
--regextrans2 "s/[ ]+/_/g" is there to convert blank characters not
|
--regextrans2 "s/[ ]+/_/g" is there to convert blank characters not
|
||||||
accepted by gmail to character _ underscore. In fact only leading
|
accepted by gmail to character _ underscore. In fact only leading
|
||||||
and trailing blank characters are problems with gmail, and
|
and trailing blank characters are problems with gmail, and
|
||||||
|
@ -332,6 +339,9 @@ not accepted by gmail, character ^ to character _ underscore.
|
||||||
--regextrans2 "s/['\"\\\\]/_/g" is optional. It converts
|
--regextrans2 "s/['\"\\\\]/_/g" is optional. It converts
|
||||||
characters ' or " or \ to character _ underscore.
|
characters ' or " or \ to character _ underscore.
|
||||||
|
|
||||||
|
--folderlast "[Gmail]/All Mail" makes imapsync leave the All Aail
|
||||||
|
folder until the last.
|
||||||
|
|
||||||
You can select folders exported to imap within the gmail preferences.
|
You can select folders exported to imap within the gmail preferences.
|
||||||
Select or unselect some "System labels", depending on your needs.
|
Select or unselect some "System labels", depending on your needs.
|
||||||
|
|
||||||
|
@ -363,7 +373,7 @@ imapsync \
|
||||||
--maxbytesafter 2_500_000_000
|
--maxbytesafter 2_500_000_000
|
||||||
--automap \
|
--automap \
|
||||||
--maxsleep 2 \
|
--maxsleep 2 \
|
||||||
--skipcrossduplicates \
|
--noskipcrossduplicates --skipallmailduplicates \
|
||||||
--useheader="X-Gmail-Received" \
|
--useheader="X-Gmail-Received" \
|
||||||
--useheader "Message-Id" \
|
--useheader "Message-Id" \
|
||||||
--regextrans2 "s,\[Gmail\].,," \
|
--regextrans2 "s,\[Gmail\].,," \
|
||||||
|
@ -421,6 +431,11 @@ label CanWait and only it.
|
||||||
--skipcrossduplicates, will only put in "[Gmail]/All Mail"
|
--skipcrossduplicates, will only put in "[Gmail]/All Mail"
|
||||||
the messages that are not labeled at all.
|
the messages that are not labeled at all.
|
||||||
|
|
||||||
|
--skipallmailduplicates is similar to --skipcrossduplicates but it only
|
||||||
|
skips messages in the [GMAIL]/All Mail folder. Messages with two or
|
||||||
|
more other labels are copied to all the corresponding IMAP folders on
|
||||||
|
the destination. --skipallmailduplicates is the default with --gmail1.
|
||||||
|
|
||||||
|
|
||||||
https://imapsync.lamiral.info/FAQ.d/FAQ.Gmail.txt
|
https://imapsync.lamiral.info/FAQ.d/FAQ.Gmail.txt
|
||||||
=======================================================================
|
=======================================================================
|
||||||
|
|
6
README
6
README
|
@ -314,9 +314,13 @@ OPTIONS
|
||||||
X is not also Gmail.
|
X is not also Gmail.
|
||||||
Activated with --gmail1 unless --noskipcrossduplicates
|
Activated with --gmail1 unless --noskipcrossduplicates
|
||||||
|
|
||||||
|
--skipallmailduplicates : Used when host1 is GMail. Skips messages in
|
||||||
|
[Gmail]/All Mail that are also in some other folder.
|
||||||
|
|
||||||
--debugcrossduplicates : Prints which messages (UIDs) are skipped with
|
--debugcrossduplicates : Prints which messages (UIDs) are skipped with
|
||||||
--skipcrossduplicates (and in what other folders
|
--skipcrossduplicates (and in what other folders
|
||||||
they are).
|
they are). Also prints messages skipped by
|
||||||
|
--skipallmailduplicates.
|
||||||
|
|
||||||
--pipemess cmd : Apply this cmd command to each message content
|
--pipemess cmd : Apply this cmd command to each message content
|
||||||
before the copy.
|
before the copy.
|
||||||
|
|
|
@ -331,9 +331,13 @@ OPTIONS
|
||||||
X is not also Gmail.
|
X is not also Gmail.
|
||||||
Activated with --gmail1 unless --noskipcrossduplicates
|
Activated with --gmail1 unless --noskipcrossduplicates
|
||||||
|
|
||||||
|
--skipallmailduplicates : Used when host1 is GMail. Skips messages in
|
||||||
|
[Gmail]/All Mail that are also in some other folder.
|
||||||
|
|
||||||
--debugcrossduplicates : Prints which messages (UIDs) are skipped with
|
--debugcrossduplicates : Prints which messages (UIDs) are skipped with
|
||||||
--skipcrossduplicates (and in what other folders
|
--skipcrossduplicates (and in what other folders
|
||||||
they are).
|
they are). Also prints messages skipped by
|
||||||
|
--skipallmailduplicates.
|
||||||
|
|
||||||
--pipemess cmd : Apply this cmd command to each message content
|
--pipemess cmd : Apply this cmd command to each message content
|
||||||
before the copy.
|
before the copy.
|
||||||
|
|
|
@ -470,9 +470,13 @@ and user1 user2 are the \-\-user1 \-\-user2 values.
|
||||||
\& X is not also Gmail.
|
\& X is not also Gmail.
|
||||||
\& Activated with \-\-gmail1 unless \-\-noskipcrossduplicates
|
\& Activated with \-\-gmail1 unless \-\-noskipcrossduplicates
|
||||||
\&
|
\&
|
||||||
|
\& \-\-skipallmailduplicates : Used when host1 is GMail. Skips messages in
|
||||||
|
\& [Gmail]/All Mail that are also in some other folder.
|
||||||
|
\&
|
||||||
\& \-\-debugcrossduplicates : Prints which messages (UIDs) are skipped with
|
\& \-\-debugcrossduplicates : Prints which messages (UIDs) are skipped with
|
||||||
\& \-\-skipcrossduplicates (and in what other folders
|
\& \-\-skipcrossduplicates (and in what other folders
|
||||||
\& they are).
|
\& they are). Also prints messages skipped by
|
||||||
|
\& \-\-skipallmailduplicates.
|
||||||
\&
|
\&
|
||||||
\& \-\-pipemess cmd : Apply this cmd command to each message content
|
\& \-\-pipemess cmd : Apply this cmd command to each message content
|
||||||
\& before the copy.
|
\& before the copy.
|
||||||
|
|
26
imapsync
26
imapsync
|
@ -345,10 +345,14 @@ and user1 user2 are the --user1 --user2 values.
|
||||||
in another folder, good from Gmail to X when
|
in another folder, good from Gmail to X when
|
||||||
X is not also Gmail.
|
X is not also Gmail.
|
||||||
Activated with --gmail1 unless --noskipcrossduplicates
|
Activated with --gmail1 unless --noskipcrossduplicates
|
||||||
|
|
||||||
|
--skipallmailduplicates : Used when host1 is GMail. Skips messages in
|
||||||
|
[Gmail]/All Mail that are also in some other folder.
|
||||||
|
|
||||||
--debugcrossduplicates : Prints which messages (UIDs) are skipped with
|
--debugcrossduplicates : Prints which messages (UIDs) are skipped with
|
||||||
--skipcrossduplicates (and in what other folders
|
--skipcrossduplicates (and in what other folders
|
||||||
they are).
|
they are). Also prints messages skipped by
|
||||||
|
--skipallmailduplicates.
|
||||||
|
|
||||||
--pipemess cmd : Apply this cmd command to each message content
|
--pipemess cmd : Apply this cmd command to each message content
|
||||||
before the copy.
|
before the copy.
|
||||||
|
@ -1104,7 +1108,7 @@ my(
|
||||||
$uidnext_default,
|
$uidnext_default,
|
||||||
$fixcolonbug,
|
$fixcolonbug,
|
||||||
$create_folder_old,
|
$create_folder_old,
|
||||||
$skipcrossduplicates, $debugcrossduplicates,
|
$skipcrossduplicates, $debugcrossduplicates, $skipallmailduplicates,
|
||||||
$disarmreadreceipts,
|
$disarmreadreceipts,
|
||||||
$mixfolders,
|
$mixfolders,
|
||||||
$fetch_hash_set,
|
$fetch_hash_set,
|
||||||
|
@ -2487,7 +2491,9 @@ FOLDER: foreach my $h1_fold ( @{ $sync->{h1_folders_wanted} } )
|
||||||
|
|
||||||
if ( ( not exists $h2_hash{ $m_id } )
|
if ( ( not exists $h2_hash{ $m_id } )
|
||||||
and ( not ( exists $sync->{ h2_folders_of_md5 }->{ $m_id } )
|
and ( not ( exists $sync->{ h2_folders_of_md5 }->{ $m_id } )
|
||||||
or not $skipcrossduplicates ) )
|
or ( not $skipcrossduplicates
|
||||||
|
and ( not $skipallmailduplicates
|
||||||
|
or $h1_fold ne "[Gmail]/All Mail" ) ) ) )
|
||||||
{
|
{
|
||||||
# copy
|
# copy
|
||||||
my $h2_msg = copy_message( $sync, $h1_msg, $h1_fold, $h2_fold, $h1_fir_ref, $permanentflags2, $cache_dir ) ;
|
my $h2_msg = copy_message( $sync, $h1_msg, $h1_fold, $h2_fold, $h1_fir_ref, $permanentflags2, $cache_dir ) ;
|
||||||
|
@ -15480,11 +15486,11 @@ sub gmail12
|
||||||
$mysync->{maxbytesafter} ||= 1_000_000_000 ;
|
$mysync->{maxbytesafter} ||= 1_000_000_000 ;
|
||||||
$mysync->{automap} = ( defined $mysync->{automap} ) ? $mysync->{automap} : 1 ;
|
$mysync->{automap} = ( defined $mysync->{automap} ) ? $mysync->{automap} : 1 ;
|
||||||
$mysync->{maxsleep} = ( defined $mysync->{maxsleep} ) ? $mysync->{maxsleep} : $MAX_SLEEP ; ;
|
$mysync->{maxsleep} = ( defined $mysync->{maxsleep} ) ? $mysync->{maxsleep} : $MAX_SLEEP ; ;
|
||||||
$skipcrossduplicates = ( defined $skipcrossduplicates ) ? $skipcrossduplicates : 0 ;
|
|
||||||
$mysync->{ synclabels } = ( defined $mysync->{ synclabels } ) ? $mysync->{ synclabels } : 1 ;
|
$mysync->{ synclabels } = ( defined $mysync->{ synclabels } ) ? $mysync->{ synclabels } : 1 ;
|
||||||
$mysync->{ resynclabels } = ( defined $mysync->{ resynclabels } ) ? $mysync->{ resynclabels } : 1 ;
|
$mysync->{ resynclabels } = ( defined $mysync->{ resynclabels } ) ? $mysync->{ resynclabels } : 1 ;
|
||||||
push @exclude, '\[Gmail\]$' ;
|
# If we resync labels then we only need to do the All Mail folder since all messages
|
||||||
push @folderlast, '[Gmail]/All Mail' ;
|
# will be in it and all will get their correct labels in the destination.
|
||||||
|
push @{ $mysync->{ folder } }, '[Gmail]/All Mail' ;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15499,7 +15505,11 @@ sub gmail1
|
||||||
$mysync->{maxbytesafter} ||= 2_500_000_000 ;
|
$mysync->{maxbytesafter} ||= 2_500_000_000 ;
|
||||||
$mysync->{automap} = ( defined $mysync->{automap} ) ? $mysync->{automap} : 1 ;
|
$mysync->{automap} = ( defined $mysync->{automap} ) ? $mysync->{automap} : 1 ;
|
||||||
$mysync->{maxsleep} = ( defined $mysync->{maxsleep} ) ? $mysync->{maxsleep} : $MAX_SLEEP ; ;
|
$mysync->{maxsleep} = ( defined $mysync->{maxsleep} ) ? $mysync->{maxsleep} : $MAX_SLEEP ; ;
|
||||||
$skipcrossduplicates = ( defined $skipcrossduplicates ) ? $skipcrossduplicates : 1 ;
|
if ( not defined $skipcrossduplicates
|
||||||
|
and not defined $skipallmailduplicates ) {
|
||||||
|
$skipcrossduplicates = 0;
|
||||||
|
$skipallmailduplicates = 1;
|
||||||
|
}
|
||||||
|
|
||||||
push @useheader, 'X-Gmail-Received', 'Message-Id' ;
|
push @useheader, 'X-Gmail-Received', 'Message-Id' ;
|
||||||
push @{ $mysync->{ regextrans2 } }, 's,\[Gmail\].,,' ;
|
push @{ $mysync->{ regextrans2 } }, 's,\[Gmail\].,,' ;
|
||||||
|
@ -15517,7 +15527,6 @@ sub gmail2
|
||||||
$mysync->{maxbytesafter} ||= 1_000_000_000 ; # In fact it is documented as half: 500_000_000
|
$mysync->{maxbytesafter} ||= 1_000_000_000 ; # In fact it is documented as half: 500_000_000
|
||||||
|
|
||||||
$mysync->{automap} = ( defined $mysync->{automap} ) ? $mysync->{automap} : 1 ;
|
$mysync->{automap} = ( defined $mysync->{automap} ) ? $mysync->{automap} : 1 ;
|
||||||
#$skipcrossduplicates = ( defined $skipcrossduplicates ) ? $skipcrossduplicates : 1 ;
|
|
||||||
$mysync->{ expunge1 } = ( defined $mysync->{ expunge1 } ) ? $mysync->{ expunge1 } : 1 ;
|
$mysync->{ expunge1 } = ( defined $mysync->{ expunge1 } ) ? $mysync->{ expunge1 } : 1 ;
|
||||||
$mysync->{addheader} = ( defined $mysync->{addheader} ) ? $mysync->{addheader} : 1 ;
|
$mysync->{addheader} = ( defined $mysync->{addheader} ) ? $mysync->{addheader} : 1 ;
|
||||||
$mysync->{maxsleep} = ( defined $mysync->{maxsleep} ) ? $mysync->{maxsleep} : $MAX_SLEEP ; ;
|
$mysync->{maxsleep} = ( defined $mysync->{maxsleep} ) ? $mysync->{maxsleep} : $MAX_SLEEP ; ;
|
||||||
|
@ -16802,6 +16811,7 @@ sub get_options_cmd
|
||||||
'maxsleep=f' => \$mysync->{maxsleep},
|
'maxsleep=f' => \$mysync->{maxsleep},
|
||||||
'skipcrossduplicates!' => \$skipcrossduplicates,
|
'skipcrossduplicates!' => \$skipcrossduplicates,
|
||||||
'debugcrossduplicates!' => \$debugcrossduplicates,
|
'debugcrossduplicates!' => \$debugcrossduplicates,
|
||||||
|
'skipallmailduplicates!' => \$skipallmailduplicates,
|
||||||
'log!' => \$mysync->{log},
|
'log!' => \$mysync->{log},
|
||||||
'tail!' => \$mysync->{tail},
|
'tail!' => \$mysync->{tail},
|
||||||
'logfile=s' => \$mysync->{logfile},
|
'logfile=s' => \$mysync->{logfile},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue