In case somehow, you got duplicate mails in a maildir, like me, maybe this is helpful to you:
find /var/mail/user -type d -name cur -print0 | xargs -0 /usr/bin/fdupes -n | less
Of course you need fdupes installed. On debian:
apt-get install fdupes
The above command is the dry run, showing you the duplicates.
Then to delete the duplicates, leaving only the first found file:
find /var/mail/user -type d -name cur -print0 | xargs -0 /usr/bin/fdupes -ndN | less
Use the same thing again with “new” instead of “cur” if you have duplicate unread mails. This only looks at duplicates within the same folder, so you can also safely run it on /var/mail for all users.
Note that this assumes the duplicates have exactly the same content. If you want to clean duplicates which are a bit different, consider this tool.