[GH-ISSUE #3004] imap-migration doesn't work properly. #1730

Open
opened 2026-02-27 11:18:49 +03:00 by kerem · 11 comments
Owner

Originally created by @lolhunter121 on GitHub (May 12, 2023).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/3004

Impacted versions

  • OS Type: Debian/Ubuntu, Centos/Redhat, Arch, Gentoo, Slack, ...
  • OS Version: Number or Name
  • Database Type: PostgreSQL / MySQL
  • Database version: X.y
  • Modoboa: 2.1.2
  • installer used: Yes ?
  • Webserver: Nginx/Apache

Steps to reproduce

Current behavior

Expected behavior

Video/Screenshot link (optional)

Originally created by @lolhunter121 on GitHub (May 12, 2023). Original GitHub issue: https://github.com/modoboa/modoboa/issues/3004 # Impacted versions * OS Type: Debian/Ubuntu, Centos/Redhat, Arch, Gentoo, Slack, ... * OS Version: Number or Name * Database Type: PostgreSQL / MySQL * Database version: X.y * Modoboa: 2.1.2 * installer used: Yes ? * Webserver: Nginx/Apache # Steps to reproduce # Current behavior <!-- Freshly installed modoboa. Added domain for imap migration. Logged in with user info. User added, BUT doesn't work webmail. Checked. Mail-folder for user didn't made. Added mail folder by hands. Imap migration doesn't start. --> # Expected behavior # Video/Screenshot link (optional)
Author
Owner

@Spitfireap commented on GitHub (Jun 21, 2023):

Hi, can you elaborate ?

<!-- gh-comment-id:1601149071 --> @Spitfireap commented on GitHub (Jun 21, 2023): Hi, can you elaborate ?
Author
Owner

@lolhunter121 commented on GitHub (Jun 21, 2023):

Hi, can you elaborate ?

Hmm. Comment lost.
I've added new domain.
Then added imap migration to it.
Logged in with imap account of old domain.
New user singed in - it work. Imap migration show new user.
Webmail doesn't work. No folders on disk made for new user.
Imap migration doesn't start - seems like new user stucked in "non-made" situation, or rights of made-by-hands folders are not right. So emails doesn't sync.
Maybe something not finished in scripts, witch made users by imap-migration login

<!-- gh-comment-id:1601297437 --> @lolhunter121 commented on GitHub (Jun 21, 2023): > Hi, can you elaborate ? Hmm. Comment lost. I've added new domain. Then added imap migration to it. Logged in with imap account of old domain. New user singed in - it work. Imap migration show new user. Webmail doesn't work. No folders on disk made for new user. Imap migration doesn't start - seems like new user stucked in "non-made" situation, or rights of made-by-hands folders are not right. So emails doesn't sync. Maybe something not finished in scripts, witch made users by imap-migration login
Author
Owner

@JustusW commented on GitHub (Aug 14, 2023):

Hi, can you elaborate ?

I'd love to add my elaboration, but I haven't found anything that I could elaborate on? Like... What's the procedure?

  1. I entered my old domain and server details on the IMAP Migration Providers Section.
  2. The Connection test yields 2 green checkmarks on the button but no other visible sign of success.
  3. I tried logging in via the webinterface and imap with no success.
  4. I created the domain and then the user with no success.
  5. I manually toyed around with a few offlineimap configurations to no avail.

No idea what to do here.

EDIT
I should note that the documentation is very confusing here. It clearly states that certain capabilities are only available in the new UI, but it very definitely exists in the old UI as well.
EDIT2
My old mailserver doesn't even show a login attempt, so clearly something isn't working as expected, I certainly can't see how this is supposed to work:
"Migrations are automatically handled when providers have been configured. Users use their old credential to log and the account is automatically created."

<!-- gh-comment-id:1676820025 --> @JustusW commented on GitHub (Aug 14, 2023): > Hi, can you elaborate ? I'd love to add my elaboration, but I haven't found anything that I could elaborate on? Like... What's the procedure? 1. I entered my old domain and server details on the IMAP Migration Providers Section. 2. The Connection test yields 2 green checkmarks on the button but no other visible sign of success. 3. I tried logging in via the webinterface and imap with no success. 4. I created the domain and then the user with no success. 5. I manually toyed around with a few offlineimap configurations to no avail. No idea what to do here. *EDIT* I should note that the documentation is very confusing here. It clearly states that certain capabilities are only available in the new UI, but it very definitely exists in the old UI as well. *EDIT2* My old mailserver doesn't even show a login attempt, so clearly something isn't working as expected, I certainly can't see how this is supposed to work: "Migrations are automatically handled when providers have been configured. Users use their old credential to log and the account is automatically created."
Author
Owner

@lolhunter121 commented on GitHub (Aug 14, 2023):

You should open web interface with login/password from account you push.
For exmaple you had mail on gmail.
test@gmail.com : 1111111
So you add gmail imap as imap migration and try to login to new web with test@gmail.com : 1111111
As I understand - it try to login on old server. After that it should make a cron task to get mails from it.
But when I login - no maildir made and no cron tast made too.

<!-- gh-comment-id:1676911471 --> @lolhunter121 commented on GitHub (Aug 14, 2023): You should open web interface with login/password from account you push. For exmaple you had mail on gmail. test@gmail.com : 1111111 So you add gmail imap as imap migration and try to login to new web with test@gmail.com : 1111111 As I understand - it try to login on old server. After that it should make a cron task to get mails from it. But when I login - no maildir made and no cron tast made too.
Author
Owner

@mateyelative commented on GitHub (Nov 6, 2023):

Hi, I am experiencing the same problem. IMAP does not sync...
Any news/updates on this issue/bug?

Thank you.
I appreciate all your hard work.

<!-- gh-comment-id:1796167746 --> @mateyelative commented on GitHub (Nov 6, 2023): Hi, I am experiencing the same problem. IMAP does not sync... Any news/updates on this issue/bug? Thank you. I appreciate all your hard work.
Author
Owner

@lolhunter121 commented on GitHub (Nov 7, 2023):

Hi, I am experiencing the same problem. IMAP does not sync... Any news/updates on this issue/bug?

Thank you. I appreciate all your hard work.

I've used imapsync on vps and synced all mails.

<!-- gh-comment-id:1797988805 --> @lolhunter121 commented on GitHub (Nov 7, 2023): > Hi, I am experiencing the same problem. IMAP does not sync... Any news/updates on this issue/bug? > > Thank you. I appreciate all your hard work. I've used imapsync on vps and synced all mails.
Author
Owner

@mateyelative commented on GitHub (Nov 7, 2023):

Hi, I am experiencing the same problem. IMAP does not sync... Any news/updates on this issue/bug?
Thank you. I appreciate all your hard work.

I've used imapsync on vps and synced all mails.

Oh. wouw... I owe you a lunch or something... 🤗💜
Thank you. That was awesome suggestion.

https://imapsync.lamiral.info/X/

I wish you all the best.

<!-- gh-comment-id:1798787629 --> @mateyelative commented on GitHub (Nov 7, 2023): > > Hi, I am experiencing the same problem. IMAP does not sync... Any news/updates on this issue/bug? > > Thank you. I appreciate all your hard work. > > I've used imapsync on vps and synced all mails. Oh. wouw... I owe you a lunch or something... 🤗💜 Thank you. That was awesome suggestion. https://imapsync.lamiral.info/X/ I wish you all the best.
Author
Owner

@michalhana99 commented on GitHub (Dec 26, 2023):

The problem persists even in version 2.2.3, synchronization of mailboxes does not start and cannot be started even manually.

I followed the instructions: https://modoboa.readthedocs.io/en/latest/moving.html

But basically I end up already at "python manage.py generate_offlineimap_config"
Do you have any news, it is possible that I am doing something wrong, we are running modoboa on debian 12 and python3 is installed and it was done using automatic installation.

Can you help?

I can't force users to enter data into an external email interface for migration

Please help

<!-- gh-comment-id:1869479558 --> @michalhana99 commented on GitHub (Dec 26, 2023): The problem persists even in version 2.2.3, synchronization of mailboxes does not start and cannot be started even manually. I followed the instructions: https://modoboa.readthedocs.io/en/latest/moving.html But basically I end up already at "python manage.py generate_offlineimap_config" Do you have any news, it is possible that I am doing something wrong, we are running modoboa on debian 12 and python3 is installed and it was done using automatic installation. Can you help? I can't force users to enter data into an external email interface for migration Please help
Author
Owner

@lolhunter121 commented on GitHub (Dec 26, 2023):

The problem persists even in version 2.2.3, synchronization of mailboxes does not start and cannot be started even manually.

I followed the instructions: https://modoboa.readthedocs.io/en/latest/moving.html

But basically I end up already at "python manage.py generate_offlineimap_config" Do you have any news, it is possible that I am doing something wrong, we are running modoboa on debian 12 and python3 is installed and it was done using automatic installation.

Can you help?

I can't force users to enter data into an external email interface for migration

Please help

You can setup imapsync locally.
https://imapsync.lamiral.info/#install
I setup it on clean LXC container and start by bash scripts.
For modoboa - didn't checked.

<!-- gh-comment-id:1869527885 --> @lolhunter121 commented on GitHub (Dec 26, 2023): > The problem persists even in version 2.2.3, synchronization of mailboxes does not start and cannot be started even manually. > > I followed the instructions: https://modoboa.readthedocs.io/en/latest/moving.html > > But basically I end up already at "python manage.py generate_offlineimap_config" Do you have any news, it is possible that I am doing something wrong, we are running modoboa on debian 12 and python3 is installed and it was done using automatic installation. > > Can you help? > > I can't force users to enter data into an external email interface for migration > > Please help You can setup imapsync locally. https://imapsync.lamiral.info/#install I setup it on clean LXC container and start by bash scripts. For modoboa - didn't checked.
Author
Owner

@vchrizz commented on GitHub (Feb 10, 2025):

The problem persists even in version 2.2.3, synchronization of mailboxes does not start and cannot be started even manually.

I followed the instructions: https://modoboa.readthedocs.io/en/latest/moving.html

But basically I end up already at "python manage.py generate_offlineimap_config" Do you have any news, it is possible that I am doing something wrong, we are running modoboa on debian 12 and python3 is installed and it was done using automatic installation.

I am also facing this issue using automatic installation of modoboa version 2.3.4 on clean Ubuntu 22.04 (just installed offlineimap beforehand).
Same issue is with Ubuntu 24.04.

Using Ubuntu 20.04 the automatic installation fails with a python traceback at installing modoboa:
def get_password_hashers(cls) -> list[type["PasswordHasher"]]:\nTypeError: 'type' object is not subscriptable\n'

Some elaboration from my side - after following commands:

sudo su - vmail
PYTHON=/srv/modoboa/env/bin/python
INSTANCE=/srv/modoboa/instance
cd /srv/vmail && $PYTHON $INSTANCE/manage.py generate_offlineimap_config --output .offlineimaprc

the content of /srv/vmail/.offlineimaprc is:

[general]
accounts =

Even though I defined the old provider in admin interface, logins with old accounts (as described in documentation/instructions) just fail.
I tried creating the .offlineimaprc by myself according to https://www.offlineimap.org/doc/quick_start.html
but then running offlineimap manually fails with following error:

$ offlineimap
OfflineIMAP 8.0.0
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
imaplib2 v3.05, Python v3.10.12, OpenSSL 3.0.2 15 Mar 2022
Account sync account@domain.tld:
 *** Processing account account@domain.tld
 Establishing connection to mail.domain.tld:143 (Remote)
 ERROR: While attempting to sync account 'account@domain.tld'
  'int' object is not subscriptable
 *** Finished account 'account@domain.tld' in 0:00
ERROR: Exceptions occurred during the run!
ERROR: While attempting to sync account 'account@domain.tld'
  'int' object is not subscriptable

Traceback:
  File "/usr/share/offlineimap3/offlineimap/accounts.py", line 298, in syncrunner
    self.__sync()
  File "/usr/share/offlineimap3/offlineimap/accounts.py", line 374, in __sync
    remoterepos.getfolders()
  File "/usr/share/offlineimap3/offlineimap/repository/IMAP.py", line 681, in getfolders
    imapobj = self.imapserver.acquireconnection()
  File "/usr/share/offlineimap3/offlineimap/imapserver.py", line 683, in acquireconnection
    e.args[0][:35] == 'IMAP4 protocol error: socket error:':

Interestingly the connection test in new-admin at provider definition succeeds.
So this seems to be an issue at offlineimap?

<!-- gh-comment-id:2648276134 --> @vchrizz commented on GitHub (Feb 10, 2025): > The problem persists even in version 2.2.3, synchronization of mailboxes does not start and cannot be started even manually. > > I followed the instructions: https://modoboa.readthedocs.io/en/latest/moving.html > > But basically I end up already at "python manage.py generate_offlineimap_config" Do you have any news, it is possible that I am doing something wrong, we are running modoboa on debian 12 and python3 is installed and it was done using automatic installation. I am also facing this issue using automatic installation of modoboa version 2.3.4 on clean Ubuntu 22.04 (just installed offlineimap beforehand). Same issue is with Ubuntu 24.04. Using Ubuntu 20.04 the automatic installation fails with a python traceback at installing modoboa: def get_password_hashers(cls) -> list[type["PasswordHasher"]]:\nTypeError: \'type\' object is not subscriptable\n' Some elaboration from my side - after following commands: ``` sudo su - vmail PYTHON=/srv/modoboa/env/bin/python INSTANCE=/srv/modoboa/instance cd /srv/vmail && $PYTHON $INSTANCE/manage.py generate_offlineimap_config --output .offlineimaprc ``` the content of /srv/vmail/.offlineimaprc is: ``` [general] accounts = ``` Even though I defined the old provider in admin interface, logins with old accounts (as described in documentation/instructions) just fail. I tried creating the .offlineimaprc by myself according to https://www.offlineimap.org/doc/quick_start.html but then running offlineimap manually fails with following error: ``` $ offlineimap OfflineIMAP 8.0.0 Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception) imaplib2 v3.05, Python v3.10.12, OpenSSL 3.0.2 15 Mar 2022 Account sync account@domain.tld: *** Processing account account@domain.tld Establishing connection to mail.domain.tld:143 (Remote) ERROR: While attempting to sync account 'account@domain.tld' 'int' object is not subscriptable *** Finished account 'account@domain.tld' in 0:00 ERROR: Exceptions occurred during the run! ERROR: While attempting to sync account 'account@domain.tld' 'int' object is not subscriptable Traceback: File "/usr/share/offlineimap3/offlineimap/accounts.py", line 298, in syncrunner self.__sync() File "/usr/share/offlineimap3/offlineimap/accounts.py", line 374, in __sync remoterepos.getfolders() File "/usr/share/offlineimap3/offlineimap/repository/IMAP.py", line 681, in getfolders imapobj = self.imapserver.acquireconnection() File "/usr/share/offlineimap3/offlineimap/imapserver.py", line 683, in acquireconnection e.args[0][:35] == 'IMAP4 protocol error: socket error:': ``` Interestingly the connection test in new-admin at provider definition succeeds. So this seems to be an issue at offlineimap?
Author
Owner

@ZiganshinIB commented on GitHub (Sep 1, 2025):

It works for me.
I set it up as follows (My OS Debian 12.7 x64)
0. Installed offlineimap:
sudo apt install offlineimap

  1. Added the old IMAP in the settings (IMAP Migration -> Email Provide).
  2. Then logged into Modoboa under the user from the old email. (I didn't create the user manually)
  3. On the new Modoboa server, I generated offlinenamemap:

sudo -u <mail_user><modoboa_env_pythorn> <modoboa_instance>/manage.py generate_offlineimap_config --output <path/to/.offlineimaprc>

sudo -u vmail /srv/modoboa/env/bin/python /srv/modoboa/instance/manage.py generate_offlineimap_config --output /tmp/.offlineimaprc

  1. I ran the migration

sudo -u <mail_user>offlineimap -c <path/to/.offlineimaprc>
sudo -u vmail offlineimap -c /tmp/.offlineimaprc

  1. Now all that's left is to automate it in /etc/cron.d/modoboa/

PYTHON=/srv/modoboa/env/bin/python
INSTANCE=/srv/modoboa/instance
MAILTO=root

30 */1 * * * vmail cd /mnt/Maildir && $PYTHON $INSTANCE/manage.py generate_offlineimap_config --output .offlineimaprc
32 */1 * * * vmail /usr/local/bin/offlineimap > /dev/null 2>&1

Operations on mailboxes

#.....

<!-- gh-comment-id:3241035295 --> @ZiganshinIB commented on GitHub (Sep 1, 2025): It works for me. I set it up as follows (My OS Debian 12.7 x64) 0. Installed offlineimap: sudo apt install offlineimap 1. Added the old IMAP in the settings (`IMAP Migration -> Email Provide`). 2. Then logged into Modoboa under the user from the old email. (I didn't create the user manually) 3. On the new Modoboa server, I generated offlinenamemap: `sudo -u <mail_user><modoboa_env_pythorn> <modoboa_instance>/manage.py generate_offlineimap_config --output <path/to/.offlineimaprc>` `sudo -u vmail /srv/modoboa/env/bin/python /srv/modoboa/instance/manage.py generate_offlineimap_config --output /tmp/.offlineimaprc` 4. I ran the migration `sudo -u <mail_user>offlineimap -c <path/to/.offlineimaprc>` `sudo -u vmail offlineimap -c /tmp/.offlineimaprc` 5. Now all that's left is to automate it in /etc/cron.d/modoboa/ PYTHON=/srv/modoboa/env/bin/python INSTANCE=/srv/modoboa/instance MAILTO=root 30 */1 * * * vmail cd /mnt/Maildir && $PYTHON $INSTANCE/manage.py generate_offlineimap_config --output .offlineimaprc 32 */1 * * * vmail /usr/local/bin/offlineimap > /dev/null 2>&1 # Operations on mailboxes #.....
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1730
No description provided.