How to Migrate Mailboxes Easily With Imapsync on Ubuntu 16.04 LTS

While migrating websites is usually not a problem, sometimes it's more difficult to migrate email boxes. This is especially the case when two servers do not use the same software. Fortunately, to simplify this step, there are many tools, including Imapsync, which is the one we are going to talk about today.

Imapsync tool makes it possible to synchronize mailboxes using the IMAP protocol. This will only work if you also use IMAP to retrieve your emails, or if you do not erase your emails from the server with the POP protocol.

Requirements

  • A sudo user.
  • A Vultr Ubuntu 16.04 LTS server instance.

Before installing any packages on the Ubuntu server instance, it is recommended that you update the system.

sudo apt-get update
sudo apt-get -y upgrade

Installation

First, you need to install the necessary prerequisites to run Imapsync.

sudo apt-get install \
    git                  \
    libauthen-ntlm-perl    \
    libclass-load-perl     \
    libcrypt-ssleay-perl   \
    libdata-uniqid-perl    \
    libdigest-hmac-perl    \
    libdist-checkconflicts-perl \
    libfile-copy-recursive-perl \
    libio-compress-perl     \
    libio-socket-inet6-perl \
    libio-socket-ssl-perl   \
    libio-tee-perl          \
    libmail-imapclient-perl \
    libmodule-scandeps-perl \
    libnet-ssleay-perl      \
    libpar-packer-perl      \
    libreadonly-perl        \
    libsys-meminfo-perl     \
    libterm-readkey-perl    \
    libtest-fatal-perl      \
    libtest-mock-guard-perl \
    libtest-pod-perl        \
    libtest-requires-perl   \
    libtest-simple-perl     \
    libunicode-string-perl  \
    liburi-perl             \
    make                    \
    cpanminus               \

It may be necessary to update the IMAP and JSON clients with cpanm.

sudo cpanm Mail::IMAPClient
sudo cpanm JSON::WebToken

Download the latest Imapsync code from its official Git repository.

git clone https://github.com/imapsync/imapsync.git

Navigate to the newly cloned repository and install it with the following commands on your system.

cd imapsync
mkdir -p dist
sudo make install

You can check the version of Imapsync using the following command.

imapsync -v

Syncing Emails

The syntax for syncing emails from server1 to server2 using only the required options is shown below.

imapsync --host1 server1.imap.tld --user1 mailbox@email.tld --password1 password1  --host2 server2.imap.tld --user2 mailbox@email.tld --password2 password2

Passwords

To avoid entering plain text mailbox passwords, you can store them in files and use the --passfile1 and --passfile2 arguments to automatically load them from the files containing the passwords.

imapsync --host1 server1.imap.tld --user1 mailbox@email.tld --passfile2 /home/user/pass1 --host2 server2.imap.tld --user2 mailbox@email.tld --passfile2 /home/user/pass2

The connection to the IMAP server

Several options are available to connect Imapsync to your mail server, including the type of connection used. By default, Imapsync will try to use SSL or TLS on port 993 to connect. The following are examples for the connection on the server to migrate (replace 1 with 2 for the second server).

  • --nossl1 for an unencrypted connection via port 143 (not recommended)
  • --ssl1 for an encrypted connection with SSL via port 993
  • --tls1 to connect with TLS via port 993

There are also options to define the type of authentication. This is specified with the --authmech1 and --authmech2 arguments, whose possible values are as follows (in upper case).

  • PLAIN
  • LOGIN
  • CRAM-MD5

Folders

Folder synchronization can cause problems, especially if the default folders, (Inbox, Spam, Archive, Sent), are not named the same on both mail servers. Imapsync offers several options for this:

  • --automap to use automatic default folder recognition.
  • --nomixfolders to avoid merging folders with a similar name according to case sensitivity.
  • --prefix1 to remove a prefix from the folders to migrate.
  • --prefix2 to add a prefix to migrated folders.
  • --skipemptyfolders to not recreate empty folders on the destination server.

Migration options

To speed up email migration, you can use the --usecache argument to temporarily store the folders on the server where you installed Imapsync.

You can also delete messages from the first server with the --delete1 argument.

Finally, before starting your migration, do not hesitate to use the --dry argument to check the result of a command, without executing it.



Leave a Comment

Cómo configurar Spamassassin con Postfix en Ubuntu 16.04

Cómo configurar Spamassassin con Postfix en Ubuntu 16.04

Spamassassin es un filtro de correo gratuito y de código abierto escrito en Perl que se utiliza para identificar el correo no deseado mediante una amplia gama de pruebas heurísticas en los encabezados y el cuerpo del correo

How to Install RainLoop Webmail on Ubuntu 16.04

How to Install RainLoop Webmail on Ubuntu 16.04

Using a Different System? RainLoop is a simple, modern and fast web-based email client. RainLoop source code is hosted on Github. This guide will show you ho

Cómo arreglar que Office 365 no reciba correos electrónicos - ayuda de Office

Cómo arreglar que Office 365 no reciba correos electrónicos - ayuda de Office

En caso de que los miembros de su grupo de Office 365 no estén recibiendo correos electrónicos, deberá asegurarse de que los usuarios estén suscritos y cambiar la configuración del grupo.

How to Install Mailtrain Newsletter Application on Ubuntu 16.04

How to Install Mailtrain Newsletter Application on Ubuntu 16.04

Using a Different System? Mailtrain is an open-source self hosted newsletter app built on Node.js and MySQL/MariaDB. Mailtrains source is on GitHub. Thi

How to Install Mailtrain Newsletter Application on CentOS 7

How to Install Mailtrain Newsletter Application on CentOS 7

Using a Different System? Mailtrain is an open-source self hosted newsletter app built on Node.js and MySQL/MariaDB. Mailtrains source is on GitHub. Thi

How to Install Mailtrain Newsletter Application on Debian 9

How to Install Mailtrain Newsletter Application on Debian 9

Using a Different System? Mailtrain is an open-source self hosted newsletter app built on Node.js and MySQL/MariaDB. Mailtrains source is on GitHub. Thi

Instale sSMTP con Mailtrap para el desarrollo de aplicaciones web en Ubuntu 16.04

Instale sSMTP con Mailtrap para el desarrollo de aplicaciones web en Ubuntu 16.04

En este tutorial, aprenderá cómo instalar sSMTP, un servidor de reenvío simple. Mailtrap.io ofrece un servidor de correo electrónico falso para desarrolladores. Úselo para enviar

How to Install RainLoop Webmail on Fedora 28

How to Install RainLoop Webmail on Fedora 28

Using a Different System? RainLoop is a simple, modern and fast web-based email client. RainLoop source code is hosted on GitHub. This guide will show you ho

How to Install RainLoop Webmail on CentOS 7

How to Install RainLoop Webmail on CentOS 7

Using a Different System? RainLoop is a simple, modern and fast web-based email client. RainLoop source code is hosted on GitHub. This guide will show you ho

Construyendo su propio servidor de correo con FreeBSD 11

Construyendo su propio servidor de correo con FreeBSD 11

Ejecutar su propio servidor de correo electrónico puede ser muy gratificante. Usted está a cargo de sus datos. También le permite una mayor flexibilidad con sus opciones de entrega. sin embargo

How to Install iRedMail on Ubuntu 18.04

How to Install iRedMail on Ubuntu 18.04

Introduction Running your own mail server offers the benefit of privacy as well as the ability to create as many mail accounts as you wish for your domains.

How to Install RainLoop Webmail on Debian 9

How to Install RainLoop Webmail on Debian 9

Using a Different System? RainLoop is a simple, modern and fast web-based email client. RainLoop source code is hosted on Github. This guide will show you ho

How to Install Mail-in-a-box on Ubuntu 18.04

How to Install Mail-in-a-box on Ubuntu 18.04

Introduction Mail-in-a-box (MiaB) takes care of all the complicated configurations required to avoid security problems, provides a solid spam detection syste

How to Install Mailtrain Newsletter Application on FreeBSD 12

How to Install Mailtrain Newsletter Application on FreeBSD 12

Using a Different System? Mailtrain is an open-source self-hosted newsletter app built on Node.js and MySQL/MariaDB. Mailtrains source is on GitHub. Thi

How to Install Mailtrain Newsletter Application on Fedora 28

How to Install Mailtrain Newsletter Application on Fedora 28

Using a Different System? Mailtrain is an open-source self hosted newsletter app built on Node.js and MySQL/MariaDB. Mailtrains source is on GitHub. Thi

How to Install RainLoop Webmail on FreeBSD 12

How to Install RainLoop Webmail on FreeBSD 12

Using a Different System? RainLoop is a simple, modern and fast web-based email client. RainLoop source code is hosted on Github. This guide will show you ho

Un servidor de correo electrónico OpenBSD que utiliza OpenSMTPD, Dovecot, Rspamd y RainLoop

Un servidor de correo electrónico OpenBSD que utiliza OpenSMTPD, Dovecot, Rspamd y RainLoop

Introducción Este tutorial muestra un servidor de correo electrónico con todas las funciones que se ejecuta en OpenBSD con OpenSMTPD, Dovecot, Rspamd y RainLoop. OpenSMTPD es th

Cómo configurar un servidor de correo usando iRedMail en Ubuntu 16.04

Cómo configurar un servidor de correo usando iRedMail en Ubuntu 16.04

¿Usando un sistema diferente? Introducción Si alguna vez ha creado un servidor de correo desde cero, sabrá que puede ser una empresa tediosa. Estoy ahí

How to Migrate Mailboxes Easily With Imapsync on CentOS 7

How to Migrate Mailboxes Easily With Imapsync on CentOS 7

Using a Different System? While migrating websites is usually not a problem, sometimes its more difficult to migrate email boxes. This is especially the cas

ZPanel y Sentora en CentOS 6 x64

ZPanel y Sentora en CentOS 6 x64

ZPanel, un panel de control de alojamiento web popular, se bifurcó en 2014 a un nuevo proyecto llamado Sentora. Aprende a instalar Sentora en tu servidor con este tutorial.

Cómo instalar Vtiger CRM Open Source Edition en CentOS 7

Cómo instalar Vtiger CRM Open Source Edition en CentOS 7

Aprende cómo instalar Vtiger CRM, una aplicación de gestión de relaciones con el cliente, en CentOS 7 para aumentar tus ventas y mejorar el servicio al cliente.

Cómo instalar el servidor Counter-Strike 1.6 en Linux

Cómo instalar el servidor Counter-Strike 1.6 en Linux

Esta guía completa le mostrará cómo configurar un servidor Counter-Strike 1.6 en Linux, optimizando el rendimiento y la seguridad para el mejor juego. Aprende los pasos más recientes aquí.

¿Puede la IA luchar con un número cada vez mayor de ataques de ransomware?

¿Puede la IA luchar con un número cada vez mayor de ataques de ransomware?

Los ataques de ransomware van en aumento, pero ¿puede la IA ayudar a lidiar con el último virus informático? ¿Es la IA la respuesta? Lea aquí, sepa que la IA es una bendición o una perdición

ReactOS: ¿Es este el futuro de Windows?

ReactOS: ¿Es este el futuro de Windows?

ReactOS, un sistema operativo de código abierto y gratuito, está aquí con la última versión. ¿Puede satisfacer las necesidades de los usuarios de Windows de hoy en día y acabar con Microsoft? Averigüemos más sobre este estilo antiguo, pero una experiencia de sistema operativo más nueva.

Manténgase conectado a través de la aplicación de escritorio WhatsApp 24 * 7

Manténgase conectado a través de la aplicación de escritorio WhatsApp 24 * 7

Whatsapp finalmente lanzó la aplicación de escritorio para usuarios de Mac y Windows. Ahora puede acceder a Whatsapp desde Windows o Mac fácilmente. Disponible para Windows 8+ y Mac OS 10.9+

¿Cómo puede la IA llevar la automatización de procesos al siguiente nivel?

¿Cómo puede la IA llevar la automatización de procesos al siguiente nivel?

Lea esto para saber cómo la Inteligencia Artificial se está volviendo popular entre las empresas de pequeña escala y cómo está aumentando las probabilidades de hacerlas crecer y dar ventaja a sus competidores.

La actualización complementaria de macOS Catalina 10.15.4 está causando más problemas que resolver

La actualización complementaria de macOS Catalina 10.15.4 está causando más problemas que resolver

Recientemente, Apple lanzó macOS Catalina 10.15.4, una actualización complementaria para solucionar problemas, pero parece que la actualización está causando más problemas que conducen al bloqueo de las máquinas Mac. Lee este artículo para obtener más información

13 Herramientas comerciales de extracción de datos de Big Data

13 Herramientas comerciales de extracción de datos de Big Data

13 Herramientas comerciales de extracción de datos de Big Data

¿Qué es un sistema de archivos de diario y cómo funciona?

¿Qué es un sistema de archivos de diario y cómo funciona?

Nuestra computadora almacena todos los datos de una manera organizada conocida como sistema de archivos de diario. Es un método eficiente que permite a la computadora buscar y mostrar archivos tan pronto como presiona buscar.