Set hostname for CyberPanel Postfix/Dovecot

Things that should be checked change ‘’ to your hostname
Hostname set via

  1. hostnamectl set-hostname
  2. Postfix hostname should be configured
    postconf -e ‘myhostname =’
  3. Find and replace/update of the below paths with new hostname

Then check for your hostname like the below. In my case it was ‘’

root@cyberpanel:~# grep -ril /etc/

If you have Ipv6 you should also add your hostname to the ::1 localhost in the /etc/hosts file line like it is for the line

Semi scripted route:

HostName='' ; hostnamectl set-hostname ${HostName} ; postconf -e "myhostname = $(hostname)"; echo $(hostname) > /etc/hostname ; echo $(hostname) > /etc/mailname;

Restart Services:

systemctl restart postfix||service postfix restart && systemctl status postfix -l||service postfix status; systemctl status postfix -l||service postfix status; systemctl restart dovecot||service dovecot restart; systemctl status dovecot||service dovecot status;

Tail logs while sending or receiving mail.

tail -f /var/log/{maillog,exim_mainlog,exim_rejectlog,mail.log,mail.err,syslog} 2> /dev/null | grep -vEi 'Firewall|ftp'

I know some cloud servers have their hostname only set by dhcp

so one thing to do is do

vpsname=""; echo "hostnamectl set-hostname ${vpsname}" >> /etc/rc.d/rc.local

or via root crontab

@reboot hostnamectl set-hostname

For those using the WizardAssistant app just search “Cyberpanel Set/Fix Hostname and Postfix” in the commands box and put your hostname in the domain field and click to copy or double click(Premium users) to run the fix and restart the services.

Cyberpanel Set/Fix Hostname and Postfix via WizardAssistant App

Leave a Comment

Item added to cart.
0 items - $0.00