imapcopy

最後更新: 2016-07-26

 

介紹

imapcopy - IMAP backup, copy and migration tool

It is written in pascal and can be compiled with freepascal or delphi 3.

 * 建議用 imapsync, 因為在 Centos 上已沒有安裝包

 


安裝

# Debian

apt-get install imapcopy

# Centos 上沒有 package

Usage

imapcopy -h               <---  help

測試

-t           : Test login for all users in config file

imapcopy -t

Login on sourceserver as tester OK                             <-- Username
Login on destinationserver as tester@YOURDOMAIN OK
Getting folderlist on sourceserver OK, found 1 folder

1 User processed, 0 Messages copied, 0 Error(s)
0 Folder(s) created, 0 Folder create errors, 0 Folder not copied

-i           : Show info about servers

包括 Username Login Test

imapcopy -i

Sourceserver:
=============
Server-Info          : Dovecot ready.
Capabilities         : IMAP4REV1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT 
LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS
Personal Namespace   :
Folder sperator      : /
other Users Namespace:
Public Namespace     :
Folders to copy      : ALL
Skip this folders    : NONE

Destinationserver:
==================
Server-Info          : [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE 
STARTTLS AUTH=PLAIN AUTH=LOGIN] IMAP server ready...
Capabilities         : IMAP4REV1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT 
SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN 
NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES 
WITHIN CONTEXT=SEARCH LIST-STATUS QUOTA
Personal Namespace   :
Folder sperator      : .
other Users Namespace:
Public Namespace     :

Other Opts

-M SrcFolder : Skip match SrcFolder, -M can be specified more than once

-e           : Create emtpy folders also

-s           : Subscribe all folders (dst)

-u           : Subscribe all folders (source)

-l           : Write results to logfile imapcopy.log

-1           : Copy only the first message of each folder

 


使用

 

# 行一次行

imapcopy -1

# 之後再行

imapcopy -s -u -l copy.log

 


Configure File

Default Configure File: /usr/share/doc/imapcopy/examples/ImapCopy.cfg

ImapCopy.cfg

##############
# Sourceserver
##############
SourceServer localhost
SourcePort 143

###################
# Destinationserver
###################
DestServer localhost
DestPort 143


#################
# Folders to skip
#################
#skipfolder INBOX.Trash


#################
# Flags
#################
#AllowFlags "\Seen\Answered\Flagged\Deleted\Draft Junk NonJunk $MDNSent $Forwared"
DenyFlags "\Recent"

# If AllowFlags is specified, all not specified Flags will be
# removed and  not copied to the destination


##############################################################
# Timezone conversion
# The imap rfc is not clear on what kind of time offsets
# can be used. +XXXX -XXXX will be supported on all servers
# You can add as many entries as needed in the form
# converttimezone SRC DST
# to convert zones that your target server rejects
##############################################################
converttimezone "UTC" "+0000"



#############################
# List of users and passwords
#############################
#       SourceUser    SourcePassword   DestinationUser DestinationPassword
Copy    "foo"         "foosrcpw"       "foo"           "foodestpw"
Copy    "bar"         "barsrcpw"       "bar"           "test"

 

!! strongly advised to use DenyFlags for the "\Recent" flag.

!! all private folders and messages are copyed. Public and other users folders will be skipped.

 


注意

Source 不能用 readonly lock !! 否則 new 的 mail 抄唔到去 cur

 


 

 

 

Creative Commons license icon Creative Commons license icon