Your cPanel webmail was working fine yesterday — now users are hitting a blank screen, a 500 Internal Server Error, or a "Database Error: Connection Failed" message. Webmail depends on three moving parts: the Dovecot IMAP service, the Exim SMTP service, and the Roundcube SQLite/MySQL database. When any one of them breaks, the interface goes dark and the error message rarely tells you which layer failed.
This guide gives you a systematic, root-cause approach: read the right log, fix the right service, and get every mailbox back online without touching accounts that are still working.
💡 None of these worked? Skip the guesswork.
Get Expert Help →Step 1: Confirm Which Webmail Client Is Failing
cPanel ships with three webmail clients: Roundcube (default), Horde, and Squirrelmail. Before doing anything else, identify which one is broken — the fix differs by client.
Open a browser and navigate to each client for an affected account:
https://mail.yourdomain.com/roundcube
https://mail.yourdomain.com/horde
https://mail.yourdomain.com/squirrelmail
If Roundcube returns a 500 but Horde loads fine, the issue is Roundcube-specific (usually a database problem). If all three fail, the issue is at the service layer (Dovecot/Exim down or SSL misconfigured).
In cPanel, go to Metrics → Errors and look for entries in the last 30 minutes. Common indicators:
PHP Fatal error: Uncaught PDOException— Roundcube database corruptIMAP connection to localhost:143 failed— Dovecot not listeningSSL: error:14094416— SSL certificate mismatch on mail port
Go to WHM → Home → Restart Services. Click Mail Server (Exim) and then IMAP Server (Dovecot). Wait for each restart to report "OK".
# Restart Exim
/scripts/restartsrv_exim
# Restart Dovecot
/scripts/restartsrv_dovecot
# Confirm both are listening
ss -tlnp | grep -E ':110|:143|:993|:995|:25|:465|:587'
Expected output shows Dovecot listening on 143 (IMAP) and 993 (IMAPS), Exim on 25 and 587.
tail -100 /var/log/exim_mainlog | grep -i "error\|fail\|panic"
Look for certificate path errors or port conflicts. A common culprit is a hostname mismatch between Exim's configured FQDN and the SSL cert's CN.
# Replace cpanel_user, domain.com, and emailuser with real values
cd /home/cpanel_user/etc/domain.com/
# Rename the corrupt DB to a backup
mv emailuser.rcube.db emailuser.rcube.db.bak
# If a timestamped backup exists, use it:
# ls -lt emailuser.rcube.db.* — pick the most recent
# mv emailuser.rcube.db.1716900000 emailuser.rcube.db
Roundcube recreates the database automatically on next login. The user loses saved preferences and address book entries but regains access to all email.
In WHM, go to Email → Repair a Roundcube Installation and click Repair. This reinstalls Roundcube and migrates the database schema to the current version — useful after cPanel upgrades that change the Roundcube version.
# Run the built-in Roundcube repair script as root
/usr/local/cpanel/bin/updateuserdomains
/scripts/update_mailman_cache
/scripts/repair_roundcube --force
# Navigate to the mail directory for the affected account
cd /home/cpanel_user/mail/domain.com/emailuser/
# Rename the main index files
mv dovecot.index dovecot.index.bak
mv dovecot.index.cache dovecot.index.cache.bak
mv dovecot.index.log dovecot.index.log.bak
# Do the same for subfolders (Sent, Trash, Spam)
for dir in .Sent .Trash .Junk .Spam; do
[ -d "$dir" ] && mv "$dir/dovecot.index" "$dir/dovecot.index.bak" 2>/dev/null
[ -d "$dir" ] && mv "$dir/dovecot.index.cache" "$dir/dovecot.index.cache.bak" 2>/dev/null
done
Dovecot rebuilds indexes automatically on next login. The rebuild may take 10–30 seconds for large inboxes — warn the user before they panic at a slow load.
doveadm index -u emailuser@domain.com INBOX
doveadm index -u emailuser@domain.com '*'
Run this as root. The second command reindexes all folders including Sent and Trash.
In WHM, go to MultiPHP Manager → System PHP Version. Roundcube requires PHP 7.4 or higher. If the system PHP is set to 5.6 or 7.0, upgrade it.
chmod 755 /usr/local/cpanel/base/3rdparty/roundcube
find /usr/local/cpanel/base/3rdparty/roundcube -type f -exec chmod 644 {} \;
find /usr/local/cpanel/base/3rdparty/roundcube -type d -exec chmod 755 {} \;
# Temporarily rename to isolate the issue
mv /usr/local/cpanel/base/3rdparty/roundcube/.htaccess /usr/local/cpanel/base/3rdparty/roundcube/.htaccess.bak
Reload the webmail URL. If it now loads, a custom rewrite rule in .htaccess is conflicting with Roundcube's own rules.
rm -rf /usr/local/cpanel/base/horde/tmp/*
rm -rf /usr/local/cpanel/base/horde/static/cache/*
In WHM, go to Email → Repair a Horde Installation and click Repair. This resets the database tables and refreshes configuration files.
tail -50 /usr/local/cpanel/base/horde/log/horde.log
FAQs
Why does webmail work for some accounts but not others?
Account-specific failures almost always point to a corrupted Roundcube SQLite database or stale Dovecot index files. Use the fixes in Steps 3 and 4, targeting only the affected user's mail directory. Server-wide failures indicate a service-level problem — Dovecot or Exim is down.
Is webmail data lost when I reset the Roundcube database?
No. The Roundcube database stores only preferences, address book contacts, and UI settings — not the actual emails. Emails are stored on disk under /home/user/mail/domain.com/ and indexed by Dovecot. Resetting the .rcube.db file is safe.
How do I tell if Dovecot is actually running?
systemctl status dovecot
# or
/scripts/restartsrv_dovecot status
If Dovecot is stopped, check /var/log/messages or journalctl -u dovecot -n 50 for the reason it stopped.
Why does webmail fail after a cPanel update?
cPanel updates frequently upgrade the Roundcube version, which can require a database schema migration. If the migration fails silently, Roundcube cannot query its own tables. Run WHM → Email → Repair a Roundcube Installation immediately after any cPanel update that touches webmail.
Can I disable Horde or Squirrelmail to reduce attack surface?
Yes. In WHM, go to Tweak Settings → Mail and uncheck the webmail clients you don't want available. Disabling unused clients reduces PHP execution surface and prevents version-specific vulnerabilities in clients you're not maintaining.
Webmail outages look catastrophic but follow a short diagnostic tree: check the right log, identify whether the problem is a service (Dovecot/Exim), a database (Roundcube .rcube.db), or an index (Dovecot index files), and apply the matching fix. Most outages resolve in under ten minutes with the commands above. If you manage multiple cPanel servers and want proactive monitoring and faster resolution without emergency firefighting, CloudHouse's server management service covers webmail incidents as part of your SLA.
