I am experiencing a critical issue with my mail server that I have been unable to resolve despite extensive troubleshooting. My Roundcube login fails, and I get a Connection refused error when trying to connect via SMTP on my website.
I have followed all standard repair procedures, but the core HestiaCP CLI tools seem to be corrupted. Is there any way to fix this without resorting to a full fresh OS installation?
My Environment:
Operating System: Ubuntu 22.04 LTS
HestiaCP Version: Unsure, but installed recently.
VPS Provider: Contabo
Troubleshooting Steps and Findings:
I have confirmed that the dovecot and exim4 services are running.
My HestiaCP firewall has all mail ports (25, 143, 465, 587, 993, 995) set to ACCEPT.
The ss command shows that Exim4 is not listening on ports 465 or 587.
Bash
root@panel:~# sudo ss -tulpn | grep 465
root@panel:~#
The Exim4 log shows that it’s only listening on port 25 and has no certificate.
Bash
# (Excerpt from /var/log/exim4/mainlog)
2025-09-15 03:55:35 exim 4.97 daemon started: pid=72003, -q30m, listening for SMTP on port 25 (IPv6 and IPv4)
2025-09-15 03:55:35 Warning: No server certificate defined; will use a selfsigned one.
I attempted to rebuild the mail configuration with the v-rebuild-mail-domains command, but it gave a harmless-looking rm error and did not fix the problem.
Bash
root@panel:~# v-rebuild-mail-domains [username] [yourdomain.com]
rm: cannot remove '/home/[username]/conf/mail/[yourdomain.com]/ip': No such file or directory
The v-add-letsencrypt-mail command, which is required to add SSL, is completely missing.
Bash
root@panel:~# v-add-letsencrypt-mail [username] [yourdomain.com]
v-add-letsencrypt-mail: command not found
The standard installer script gave a safety error, and the core repair script is missing.
Bash
root@panel:~# bash /usr/local/hestia/install/upgrade/upgrade.sh
bash: /usr/local/hestia/install/upgrade/upgrade.sh: No such file or directory
A manual attempt to download the repair script also failed.
Bash
root@panel:~# wget https://raw.githubusercontent.com/hestiacp/hestiacp/release/install/upgrade/upgrade.sh
...
ERROR 404: Not Found.
It seems my HestiaCP CLI tools and core files are corrupted, preventing any automated repairs from working. Is there an alternative method or a specific command I can use to manually repair the installation without a fresh OS install?
root@panel:\~# systemctl status exim4 --no-pager -l
● exim4.service - exim Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/exim4.service; enabled; preset: enabled)
Active: active (running) since Mon 2025-09-15 04:06:10 CEST; 16h ago
Docs: man:exim(8)
https://exim.org/docs.html
Process: 82263 ExecStartPre=/usr/sbin/update-exim4.conf $UPEX4OPTS (code=exited, status=0/SUCCESS)
Main PID: 82602 (exim4)
Tasks: 1 (limit: 28794)
Memory: 14.4M (peak: 29.3M)
CPU: 18.641s
CGroup: /system.slice/exim4.service
└─82602 /usr/sbin/exim4 -bdf -q30m
Sep 15 04:06:09 panel.domain.com systemd\[1\]: Starting exim4.service - exim Mail Transport Agent…
Sep 15 04:06:10 panel.domain.com systemd\[1\]: Started exim4.service - exim Mail Transport Agent.
root@panel:\~# dpkg -l | grep exim4
ii exim4 4.97-4ubuntu4.3 all metapackage to ease Exim MTA (v4) installation
ii exim4-base 4.97-4ubuntu4.3 amd64 support files for all Exim MTA (v4) packages
ii exim4-config 4.97-4ubuntu4.3 all configuration for the Exim MTA (v4)
ii exim4-daemon-heavy 4.97-4ubuntu4.3 amd64 Exim MTA (v4) daemon with extended features, including exiscan-acl
root@panel:\~# head -n20 /etc/exim4/exim4.conf.template
#####################################################
### main/01_exim4-config_listmacrosdefs
#####################################################
######################################################################
# Runtime configuration file for Exim 4 (Debian Packaging)
######################################################################
######################################################################
# /etc/exim4/exim4.conf.template is only used with the non-split
# configuration scheme.
# /etc/exim4/conf.d/main/01_exim4-config_listmacrosdefs is only used
# with the split configuration scheme.
# If you find this comment anywhere else, somebody copied it there.
# Documentation about the Debian exim4 configuration scheme can be
# found in /usr/share/doc/exim4-base/README.Debian.gz.
######################################################################
######################################################################
# MAIN CONFIGURATION SETTINGS
######################################################################
and when I try to test smtp, it shows:
Whoops! There were some problems with your input.
Connection could not be established with host “ssl://mail.domain.com:465”: stream_socket_client(): Unable to connect to ssl://mail.domain.com:465 (Connection refused)
Whoops! There were some problems with your input.
Connection could not be established with host “ssl://mail.domain.com:465”: stream_socket_client(): Failed to enable crypto
Sep 15 23:12:59 panel.domain.com systemd[1]: Starting exim4.service - exim Mail Transport Agent…
Sep 15 23:13:00 panel.domain.com systemd[1]: Started exim4.service - exim Mail Transport Agent.
root@panel:~#
I was experiencing an issue with mail server(email client).
The mail issue was caused by a mix of configuration problems with Exim and SSL certificates. The setup was corrected by adjusting Exim’s configuration, updating TLS certificate paths, and ensuring the correct values in /etc/hosts and related configs. Additional fixes included disabling unused POP3 support in Dovecot and rebuilding the mail domain configuration.
Testing was then performed using an external mail client (Thunderbird) to confirm that both SSL and STARTTLS worked as expected. After these changes, mail delivery and authentication started working correctly.
This was all possible through the help of @sahsanu .