# After a server migration all POP3 users get duplicate unread emails - how to clean up

**URL:** <https://forum.virtualmin.com/t/after-a-server-migration-all-pop3-users-get-duplicate-unread-emails-how-to-clean-up/109931>\
**Category:** Virtualmin\
**Created:** [March 19, 2021, 6:50am UTC](https://forum.virtualmin.com/t/after-a-server-migration-all-pop3-users-get-duplicate-unread-emails-how-to-clean-up/109931 "2021-03-19T06:50:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vander.host](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/vander.host/32/4430_2.png) [@vander.host](https://forum.virtualmin.com/u/vander.host)\
**Post date:** [March 19, 2021, 6:50am UTC](https://forum.virtualmin.com/t/after-a-server-migration-all-pop3-users-get-duplicate-unread-emails-how-to-clean-up/109931/1 "2021-03-19T06:50:37Z")

</div>

I understand enough about the differences between POP3 and IMAP to know that POP3 is supposed to be used “RETRIEVE” messages from the server whereas IMAP is designed to “STORE” messages on the server.

The problem was many of our legacy users were incorrectly advised to use POP3 and a lot of them thought they got the same functionality if they click the checkbox that says “Leave a copy of the message on the server”.

Now years later when we migrate some of these large mailboxes (up to 5 GB and more) to a new server the user is ending up with duplicate unread messages.

Any advice on how to clear these unread messages up?

So far I’m recommending setting up a new IMAP account because the server unread count looks good. I then ask them to copy messages across. As you can imagine it leaves a lot of work for the end-user and would like to hear if someone has another idea?

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [March 19, 2021, 9:36am UTC](https://forum.virtualmin.com/t/after-a-server-migration-all-pop3-users-get-duplicate-unread-emails-how-to-clean-up/109931/2 "2021-03-19T09:36:03Z")

</div>

Hi,

If the actual issue is physical files themselves you could find and delete duplicate files recursively under given directory:

```auto
fdupes -dNr /home/username/Maildir/

```

**Warning:** Be careful running the command above, as it will _just delete_ found duplicate files without any further notice.

At first try running it in a harmless, listing mode and see what you got:

```auto
fdupes -r /home/Maildir/

```

> So far I’m recommending setting up a new IMAP account because the server unread count looks good. I then ask them to copy messages across.

Please check for Dovecot cache files under **~/Maildir** folder, deleting those may help.

> As you can imagine it leaves a lot of work for the end-user and would like to hear if someone has another idea?

There are command line utils, such as _ **imapsync** _ that can pull mail from remote mail servers.

---

<div class="post-metadata">

**Author:** ![system](https://cdn.forum.virtualmin.com/uploads/default/original/2X/c/cd96d761e326db4b2bef94886a639109bd7a8e76.svg) [@system](https://forum.virtualmin.com/u/system)\
**Post date:** [May 18, 2021, 9:36am UTC](https://forum.virtualmin.com/t/after-a-server-migration-all-pop3-users-get-duplicate-unread-emails-how-to-clean-up/109931/3 "2021-05-18T09:36:35Z")

</div>

Closed on May 18, 2021, 9:36am UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
