Skip to content

Enable server-side mail archiving for a domain in WHM

How to turn on incoming, outgoing, and mailman mail archiving for a cPanel domain, where the archives are stored, and how to manage retention and disk use.

Mail archiving keeps a separate, retained copy of a domain’s mail — incoming, outgoing, or both — independent of what users do in their mailboxes. It is what you reach for when a client needs to satisfy a retention policy, investigate a dispute, or recover a message a user deleted from their own inbox. cPanel builds this in at the WHM level as Archiving Configuration, with per-domain control over which directions are archived and how long copies are kept. This runbook covers enabling archiving, where the archives live, and managing the disk growth that retention inevitably brings.

What’s happening

When archiving is enabled for a domain, cPanel keeps a copy of each archived message in a dedicated archive store, separate from the user Maildirs. You choose the direction: Incoming (copies of mail delivered to the domain’s mailboxes), Outgoing (copies of mail sent from them), and Mailing list (mailman) traffic. Each direction has its own retention period — keep forever, or for a set number of days — after which cPanel prunes the older copies. Because the archive is independent of the mailbox, a user emptying their Trash or a mailbox being deleted does not touch the archived copies.

The thing to plan for is disk. An archive of all incoming and outgoing mail grows continuously and, with a “keep forever” retention, without bound. Archives consume space on the same filesystem as the accounts unless you have arranged otherwise, so a domain with heavy mail and indefinite retention can fill a disk over time. The archives are stored under the account’s home, organized by domain and direction and dated, so they are browsable and exportable but also visible in the account’s disk usage. Setting a finite retention that matches the actual policy requirement — rather than “keep everything forever” by reflex — is the difference between archiving as a safety net and archiving as a disk problem.

How to verify

Confirm the current archiving configuration for the domain.

# Per-domain archiving settings (direction + retention)
whmapi1 get_archiving_configuration domain=example.com 2>/dev/null
cat /etc/exim.pl 2>/dev/null | grep -i archive   # archiving hook references

# The archive store for the account, by domain and direction
ls -la /home/<cpaneluser>/mail/archive/example.com/ 2>/dev/null

After enabling, confirm copies are actually being written:

# Watch archiving capture a message
ls -lat /home/<cpaneluser>/mail/archive/example.com/incoming/ 2>/dev/null | head
ls -lat /home/<cpaneluser>/mail/archive/example.com/outgoing/ 2>/dev/null | head

Check how much disk the archive is consuming so retention can be tuned:

# Size of the archive store for the domain
du -sh /home/<cpaneluser>/mail/archive/example.com/ 2>/dev/null
du -sh /home/<cpaneluser>/mail/archive/example.com/*/ 2>/dev/null

The fix

  1. Open Archiving Configuration in WHM — go to WHM » Email » Archiving Configuration. Select the domain (or set a default for all domains on the server). This is a WHM/root-level feature, not something the end user enables in cPanel.

  2. Choose which directions to archive — enable Incoming, Outgoing, and/or Mailing Lists independently based on the requirement. If the policy only covers sent business mail, archive Outgoing alone rather than everything — it keeps the archive smaller and more relevant.

  3. Set a retention period that matches the policy — for each direction, set how long to keep copies. Choose a finite number of days that satisfies the actual retention obligation instead of “keep forever” unless indefinite retention is genuinely required. Retention is the main lever on disk growth.

  4. Apply per-domain rather than server-wide when policies differ — if only some domains need archiving, configure them individually rather than turning it on for every account. Archiving every domain on a busy server multiplies disk use for domains that may not need it.

  5. Plan disk capacity and monitor growth — because archives accumulate, watch the archive directory size with du over time and ensure the filesystem has headroom. If a domain’s archive will be large and long-lived, plan storage accordingly before enabling indefinite retention.

  6. Access archived mail when you need to retrieve a message — the archive store under /home/<cpaneluser>/mail/archive/<domain>/ is organized by direction and date. To retrieve a deleted or disputed message, locate it there and export it; it is a normal mail store, so standard mail tools can read it.

  7. Understand archiving is not a backup — archiving retains message copies on the same server, so it does not protect against server loss. Pair it with off-server backups if the goal includes disaster recovery; archiving answers “what was sent/received,” backups answer “restore the whole system.”

Once enabled, every message in the chosen directions is retained independently of user behavior, giving you a reliable record for compliance or recovery — as long as retention is set to a sane finite window and disk is monitored. The discipline here is matching retention to the real requirement so the archive stays a safety net, not a runaway store. Stack Harbor configures cPanel mail archiving and retention under cPanel server management — start a conversation.