E-Mail-Postfächer Migration/Synchronisierung mit IMAPSync unter Ubuntu (WSL2 geeignet)

Im Blogpost von Claudio Kuenzler wird imapsync als robustes CLI-Werkzeug vorgestellt, um IMAP-Postfächer verlustfrei zu migrieren bzw. zu sichern. Der Artikel zeigt:

Quelle: https://www.claudiokuenzler.com/blog/1038/email-migration-transfer-sync-using-imap-mailbox-imapsync

Vorbereitung (Passwortdateien sicher anlegen)

Ziel: ionos.pw und hetzner.pw mit je nur der Passphrase in Zeile 1, restriktive Rechte.

# Create secrets dir with strict permissions
mkdir -p ~/secrets
chmod 700 ~/secrets

# Create ionos password file securely
nano ~/secrets/ionos.pw
# Paste the IONOS password on line 1, save & exit (Ctrl+O, Enter, Ctrl+X)

# Create hetzner password file if not already present
nano ~/secrets/hetzner.pw
# Paste the Hetzner password on line 1, save & exit

# Restrict file permissions
chmod 600 ~/secrets/ionos.pw ~/secrets/hetzner.pw

Warum Passfile? --passfile1/2 vermeidet Klartext-Passwörter in der Prozessliste/History. (Siehe imapsync-README zu --passfile1/--passfile2.) GitHub


Optional: Installation/Update auf die neueste Version

Variante A (Debian/Ubuntu, empfohlen):

# Download the latest Debian package listed in the official dist2 index
cd /tmp
wget https://imapsync.lamiral.info/dist2/imapsync-2.309.deb
sudo apt install ./imapsync-2.309.deb

https://imapsync.lamiral.info/dist2/

Variante B (Universell, Tarball/Source):

# Get the current tarball release
cd ~/build && mkdir -p imapsync && cd imapsync
wget https://imapsync.lamiral.info/dist2/imapsync-2.290.tgz
tar xzf imapsync-2.290.tgz
# The executable script is ./imapsync inside the extracted folder

https://imapsync.lamiral.info/dist2/

Angefügt ist ebenfalls die zuletzt verwendete Version: imapsync-imapsync-2.229.tar.gz

Hinweis zu Perl-Modulen: Falls Abhängigkeiten fehlen, siehe INSTALL/TUTORIAL der offiziellen Doku.

https://imapsync.lamiral.info/INSTALL?utm_source=chatgpt.com


Dry-Run (sichere Simulation, keine Änderungen)

# DRY RUN: simulate IONOS -> Hetzner migration without transferring messages
./imapsync \
  --dry \
  --host1 imap.ionos.com --user1 'info@Schule-Freudenberg.de' --passfile1 ~/secrets/ionos.pw --ssl1 \
  --host2 mail.your-server.de --user2 'kontakt@Schule-Freudenberg.de' --passfile2 ~/secrets/hetzner.pw --ssl2 \
  --automap \
  --useuid \
  --syncinternaldates \
  --addheader \
  --exclude '(?i)spam|trash|junk' \
  --logfile ~/imapsync_ionos_to_hetzner_dry.log

Produktivlauf (tatsächliche Migration)

# REAL RUN: perform IONOS -> Hetzner migration
./imapsync \
  --host1 imap.ionos.com --user1 'info@Schule-Freudenberg.de' --passfile1 ~/secrets/ionos.pw --ssl1 \
  --host2 mail.your-server.de --user2 'kontakt@Schule-Freudenberg.de' --passfile2 ~/secrets/hetzner.pw --ssl2 \
  --automap \
  --useuid \
  --syncinternaldates \
  --addheader \
  --exclude '(?i)spam|trash|junk' \
  --logfile ~/imapsync_ionos_to_hetzner.log

Tipp: Wer zusätzlich nur die Ordner-Zuordnung prüfen will, kann einmalig --automap --justautomap testen (ohne Nachrichtenübertrag). https://imapsync.lamiral.info/S/news.shtml?utm_source=chatgpt.com


Ergebnisse prüfen & typische Hinweise


Revision #5
Created 2025-08-26 06:32:11 UTC by Admin
Updated 2025-08-26 07:01:34 UTC by Admin