Emails from [email protected]_HOSTNAME_

Just a quick one. Noticed that some of the mails I was receiving from a script I run on my server were appearing as
From: root <[email protected]_HOSTNAME_>
… although the Return Path was correctly set with the real hostname.

Couldn’t find this in exim config, or dovecot … but then found a file /etc/mailname which needed to be edited to include the correct domain name. This is Ubuntu 20:04 LTS. No idea why it wasn’t set, but I thought I’d put the solution here in case it helps someone searching the forum.