Imapsync - Linux kommandozeilen Programm zum Migreiren von E-Mail Konten
Erscheinungsbild
Script
oneliner
Script erstellen und ausführbar machen:
nano imapsync_bulk.sh
chmod +x imapsync_bulk.sh
#!/bin/sh
# value for --host1 is the IMAP source server hostname or IP address
# value for --user1 is the IMAP source user login
# value for --password1 is the IMAP source user password
# value for --host2 is the IMAP destination server hostname or IP address
# value for --user2 is the IMAP destination user login
# value for --password2 is the IMAP destination user password
# --dry makes imapsync doing nothing, just print what would be done without --dry.
# --justfolders does only things about folders (ignore messages). It is good
# --automap guesses folders mapping, for folders like
# "Sent", "Junk", "Drafts", "All", "Archive", "Flagged".
# Then remove --dry and have a run to create folders on host2.
# If everything goes well so far then remove --justfolders to
# start syncing messages.
imapsync --host1 imap.nine.ch --tls1 --user1 noreply@backup-zeberliedv.ch --password1 'PW' \
--host2 mail.computech-rz.ch --notls2 --user2 noreply@backup-zeberliedv.ch --password2 'PW' \
--automap
imapsync --host1 imap.nine.ch --tls1 --user1 noreply@backup-zeberliedv.ch --password1 'PW' \
--host2 outlook.office365.com --office2 --ssl2 --user2 migrationstest@computech.swiss --password2 'PW' \
Script Bulk
#!/bin/sh
# value for --host1 is the IMAP source server hostname or IP address
# value for --user1 is the IMAP source user login
# value for --password1 is the IMAP source user password
# value for --host2 is the IMAP destination server hostname or IP address
# value for --user2 is the IMAP destination user login
# value for --password2 is the IMAP destination user password
# --dry makes imapsync doing nothing, just print what would be done without --dry.
# --justfolders does only things about folders (ignore messages). It is good
# --automap guesses folders mapping, for folders like
# "Sent", "Junk", "Drafts", "All", "Archive", "Flagged".
# Then remove --dry and have a run to create folders on host2.
# If everything goes well so far then remove --justfolders to
# start syncing messages.
#textfile
#Server1;Username1;Passwort1;Server2,Username2;Passwort2;
{ while IFS=';' read h1 u1 p1 h2 u2 p2 fake
do
imapsync --host1 "$h1" --tls1 --user1 "$u1" --password1 "$p1" \
--host2 "$h2" --notls2 --delete2 --user2 "$u2" --password2 "$p2" \
--automap
done
} < file.txt
Server1;Username1;Passwort1;Server2,Username2;Passwort2;
Installation
Linux (Ubuntu)
apt update
apt -y upgrade
apt install -y git make gcc
apt install -y apt-file cpanminus libc6-dev libssl-dev
apt install -y libperl-dev zlib1g-dev libnet-ssleay-perl
mount -o remount,exec /tmp
cpanm App::cpanminus Authen::NTLM CGI Compress::Zlib Crypt::OpenSSL::RSA Data::Dumper Data::Uniqid Dist::CheckConflicts Encode Encode::IMAPUTF7 File::Copy::Recursive File::Tail IO::Socket::INET IO::Socket::INET6 IO::Socket::SSL IO::Tee JSON JSON::WebToken LWP::UserAgent Mail::IMAPClient Module::ScanDeps PAR::Packer Pod::Usage Readonly Regexp::Common Sys::MemInfo Term::ReadKey Test::MockObject Test::More Test::Pod Unicode::String
mount -o remount,noexec /tmp
cd /usr/local/src
git clone https://github.com/imapsync/imapsync.git
cd imapsync
make install
sudo apt-get install \
libauthen-ntlm-perl \
libclass-load-perl \
libcrypt-ssleay-perl \
libdata-uniqid-perl \
libdigest-hmac-perl \
libdist-checkconflicts-perl \
libencode-imaputf7-perl \
libfile-copy-recursive-perl \
libfile-tail-perl \
libio-compress-perl \
libio-socket-inet6-perl \
libio-socket-ssl-perl \
libio-tee-perl \
libmail-imapclient-perl \
libmodule-scandeps-perl \
libnet-dbus-perl \
libnet-ssleay-perl \
libpar-packer-perl \
libreadonly-perl \
libregexp-common-perl \
libsys-meminfo-perl \
libterm-readkey-perl \
libtest-fatal-perl \
libtest-mock-guard-perl \
libtest-mockobject-perl \
libtest-pod-perl \
libtest-requires-perl \
libtest-simple-perl \
libunicode-string-perl \
liburi-perl \
libtest-nowarnings-perl \
libtest-deep-perl \
libtest-warn-perl \
make \
cpanminus