Symptoms
After changing a server hostname in Plesk at Tools & Settings > Server Settings, emails are sent with an old hostname in a sender address.
Cause
The directive myhostname
is explicitly defined in the Postfix configuration file /etc/postfix/main.cf
:
# grep “myhostname =” /etc/postfix/main.cf
myhostname = server.example.com
Configuration defined in /etc/postfix/main.cf
overwrites server-wide configuration. By default, the myhostname
directive is disabled (commented with # at the beginning of the line) in /etc/postfix/main.cf
.
Resolution
-
Connect to the Plesk server via SSH.
-
Open the file
/etc/postfix/main.cf
in a text editor. In this example, we are using the vi editor:# vi /etc/postfix/main.cf
-
Find the
myhostname
line and apply one of the following steps:-
comment it out by placing a # (hash) character ay the beginning of the line:
# myhostname = localhost.localdomain
-
specify a fully qualified domain name (FQDN) that will be used as a sender address:
myhostname = server.example.com
-
-
Save the changes and close the file.
-
Verify the changes with the command:
# grep “myhostname =” /etc/postfix/main.cf
-
If the file
/etc/mailname
exists, make sure a correct server hostname is defined in it:# cat /etc/mailname
server.example.com -
Send an email and check sender address name.