Plesk

Mail is not working properly on a Plesk server: incorrect hostname is used

Symptoms

A hostname of a local mail server is localhost.localdomain:

# telnet 203.0.113.2 25
...
220 localhost.localdomain ESMTP Postfix


After changing hostname on the server the system notification are still send from old hostname.

Possible Consequences

Cause

Hostname is not configured properly on a server.

Resolution

  1. Log into Plesk and go to Tools & Settings > Server Settings and specify a FQDN, then click OK:

    Note: Server hostname should be resolved to a Plesk server IP address. If a hostname is unknown, contact your service provider for assistance, or use any domain you own, which points to this server.

  2. Connect to the Plesk server via SSH and check that the server hostname is configured in mail server configuration:

    Note: To find out which mail server is in use, go to Tools & Settings > Mail Server Settings > Installed mail server

    • If Postfix is used as a mail server:

      2.1. Make sure that the myhostname parameter is commented with the hash symbol "#" or has a fully qualified domain name:

      # grep "myhostname =" /etc/postfix/main.cf
      #myhostname = localhost.localdomain

      OR

      # grep "myhostname =" /etc/postfix/main.cf
      myhostname = server.example.com

      2.2. If the file /etc/mailname exists, make sure a correct server hostname is defined in it:

      # cat /etc/mailname
      server.example.com

    • If QMail is used as a mail server:

      2.1. Open/create the file /var/qmail/control/me in a text editor. In this example, we are using the "vi" editor:

      # vi /var/qmail/control/me

      2.2. Put the same hostname as on step 1:

      server.example.com

      2.3. Restart QMail:

      # service qmail restart

  3. Verify that the server hostname has been changed:

    # hostnamectl status | grep 'Static hostname'
    Static hostname: localhost.localdomain

    If the hostname is still incorrect, change it manually with the command:

    # hostnamectl set-hostname server.example.com

  4. If the server IP address was blacklisted, contact blacklist owners and report that the hostname has been changed to FQDN. Visit this KB article for details: