WF AQ

Knowledge base

Utilizzo di imapcopy

Prima occorre installare imapcopy sul server. Una versione compilata è reperibile qui.

Sito web ufficiale.

  • Navigare dove si trova il file imapcopy (solitamente /var/www/vhosts/nomedominio)
  • Editare il file ImapCopy.cfg inserendo ip della macchina sorgente, ip della macchina destinazione e tante linee “Copy…” alla fine del file tanti quanti sono gli account da copiare.
  • Avviare lo script:
    nohup ./imapcopy ImapCopy.cfg &

Per vedere l’avanzamento del processo in tempo reale:

tail -f nohup.out

N.B.: eliminare il file nohup.out ad ogni utilizzo perchè aumenta notevolmente di dimensioni.

Di seguito l’esempio del contenuto del file ImapCopy.cfg.

#############################################################
# imapcopy config
# all lines beginning with # are comments and will be ignored
#############################################################

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

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

#########
# Options
#########
#
# DebugSrc and DebugDest will show all traffic between IMAPCopy and Server
#
#DebugSrc
#DebugDst

#################
# Folders to skip
#################
#skipfolder INBOX.Trash
#skipfolder INBOX.Sent
#skipfolder "INBOX.Sent Objects"

#################
# Folders to copy
#################
#copyfolder INBOX
#copyfolder "INBOX.My personal files"
#copyfolder INBOX.Net-Connection.dy
#copyfolder INBOX.test

#######################################################
# Rootfolder
# Can be specified to copy the Folder-Structure under
# a separate folder instead of inbox
#######################################################
#DstRootFolder "Your old Mails"

###############################################################
# Specify Flags that are supported on the destination server
# (AllowFlags) or flags that should be filtered out (DenyFlags)
# If not specified, all Flags are copyied 1:1
# If AllowFlags is specified, all not specified Flags will be
# removed and  not copied to the destination
# If DenyFlags is specified, those flags will be removed and
# the remaining ones will be copied
# Both (AllowFlags and DenyFlags) could be specified but
# would (in most cases) make no sense
##############################################################
#AllowFlags "\Seen\Answered\Flagged\Deleted\Draft Junk NonJunk $MDNSent $Forwared"
DenyFlags "\Recent"

##############################################################
# 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"
converttimezone "UT"  "+0000"

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