Zimbra Duplicate Emails: 3 Easy Fixes, Avoid Mistakes

Zimbra duplicate emails have one setting behind them: the LMTP dedupe cache, controlled by zimbraMessageIdDedupeCacheSize. The Zimbra Administrator Guide describes it as the number of Message-Id header values kept in the cache; a later delivery of a message with a matching Message-Id to the same mailbox is ignored, and a value of 0 disables deduping. The default is 3000. This guide shows how to read the value, how to set it and what to check when users still see two copies of the same message.

The earlier version of this article called 0 the way to enable the feature. According to the Administrator Guide it is the opposite: 0 turns the duplicate check off. The steps below use the documented behaviour.

Why Zimbra duplicate emails happen

When a message arrives, Zimbra compares its Message-Id header with the cached values of the target mailbox. A match means the message is a copy of one that was already delivered, so it is not stored again. Zimbra duplicate emails appear when this check does not run or does not recognise the copy:

  • The cache is disabled. zimbraMessageIdDedupeCacheSize is 0, so every copy is delivered.
  • The cache is too small. The cache keeps a limited number of Message-Ids. On a busy server a copy that arrives after many other messages is no longer in the cache. This follows from the way the setting is described; the guide does not give a rule for the right size.
  • The account switch is off. The account or COS attribute zimbraPrefMessageIdDedupingEnabled turns deduping on or off per account. Its default is TRUE and it exists since Zimbra 8.0.0.
  • The copies have different Message-Ids. A sender, a mailing list or a forwarding rule that creates a new Message-Id for each copy is not caught by this check at all.

Use the first three as the checklist for Zimbra duplicate emails on your server; the fourth one is a mail flow problem, not a Zimbra setting.

Step 1: check the current dedupe cache size

Run the commands as the zimbra user on the mailbox server. zmprov gcf (getConfig) reads a global configuration attribute:

su - zimbra
zmprov gcf zimbraMessageIdDedupeCacheSize
zimbra duplicate emails: read and set zimbraMessageIdDedupeCacheSize with zmprov and restart the mailbox service
The commands that control the dedupe cache behind Zimbra duplicate emails.

The result is one line in the form zimbraMessageIdDedupeCacheSize: 3000. If it shows 0, deduping is off and that explains the Zimbra duplicate emails you see. A different positive number means somebody changed the default.

Step 2: set a positive cache size

Set the global value with zmprov mcf (modifyConfig). The default of 3000 is a good start; raise it if your server delivers many messages in a short time:

zmprov mcf zimbraMessageIdDedupeCacheSize 3000

A bigger cache needs a little more memory because more Message-Ids are kept, so increase it in steps and not to a very large number at once. The attribute is global (globalConfig in the schema), so one change applies to all mailboxes on the server.

Step 3: restart the mailbox service

The original procedure restarts the mailbox service after the change, and it is the safe way to make sure the new value is used:

zmmailboxdctl restart

Plan the restart for a quiet time, because the webmail and the IMAP and POP services of the mailbox are unavailable for a moment. Afterwards run the zmprov gcf command again to see the new value.

Step 4: check the account switch

If only some users get Zimbra duplicate emails, look at the per-account attribute. This reads it for one user:

zmprov ga user@example.com zimbraPrefMessageIdDedupingEnabled

If it is FALSE, set it back to TRUE for that account; if many accounts are affected, change it in the Class of Service instead:

zmprov ma user@example.com zimbraPrefMessageIdDedupingEnabled TRUE

How to confirm that two copies are the same message

Before you change any setting, prove that the copies really share one Message-Id. In the Zimbra web client open one copy, use the message actions to show the original source, and note the Message-ID: header. Do the same for the other copy. If both values are identical, the dedupe check did not stop the second delivery and the settings above are the right place to look. If the values differ, the sender, a list server or a forwarding rule sent two separate messages, and no Zimbra setting will remove the second one. Write the Message-Id down in your ticket, because it also helps when you search the mail logs later.

Messages sent to yourself

A special case is mail that a user sends to their own address. The attribute zimbraPrefDedupeMessagesSentToSelf controls it, with the values dedupeNone (the default), secondCopyIfOnToOrCC and dedupeAll. So a user who writes to themselves can legitimately see two copies, one in Sent and one in the Inbox; that is a user preference and not one of the Zimbra duplicate emails caused by the server.

The opposite problem: missing messages

The same cache can hide a message that should have arrived. Because later messages with the same Message-Id are ignored, a system that reuses one Message-Id (a badly written application, a test script, a resend with the original headers) will see its repeated messages dropped for the same mailbox. If you are looking for lost mail and not for Zimbra duplicate emails, this is the case where setting the cache size to 0 is a valid test: it disables deduping, and the messages should arrive. Set the old value again after the test.

FAQ

What does zimbraMessageIdDedupeCacheSize 0 do?

It disables the duplicate check, as the Administrator Guide says. Every message is delivered, including copies, so you get more Zimbra duplicate emails, not fewer.

What is the default value?

3000 Message-Id values, according to the Administrator Guide. Check your own server with zmprov gcf, because it may have been changed.

Can I find which messages were duplicates?

Compare the Message-Id headers of the two copies in the message source. Identical values mean the dedupe check missed them; different values mean the sender created two messages. See also the posts on how to check Zimbra account status and fix the zclient IO error when zmprov fails.

References

To deal with Zimbra duplicate emails, make sure the cache size is a positive number, restart the mailbox service and check the per-account switch.

Comments

Popular posts from this blog

Linux Desktop Frozen? 5 Proven Fixes Before a Hard Reboot

Minecraft Bedrock on Linux: 4 Proven Ways to Play in 2026

DXVK in Wine on Linux: 7 Easy Setup Steps, Tested