Solution 1:

You can change it in postfix configuration file /etc/postfix/main.cf.

The helo line is controlled by the smtpd_banner parameter. It probably references the myhostname option. Put your server name there instead of localhost:

myhostname = server.example.com
smtpd_banner = $myhostname

and restart postfix with sudo postfix reload.

Solution 2:

The intended goal of the post owner is to know how to set the Helo Address in Postfix config and to know at what value it is best to set it. I'll make the hypothesis that by best, we should uderstand the value that will give my mail the greatest chance to be accepted on delivery.

The helo line is controlled by the smtp_helo_name parameter. It, by default, references the myhostname parameter.

smtp_helo_name = $myhostname

In order to pass the spf_helo test, you'll need to have a corresponding SPF record in your DNS for the address smtp_helo_name references.

If you already have configured such SPF record for your domain, a straigthforward way to achieve SPF helo check is to use the domain as helo name:

smtp_helo_name = $mydomain

But it is best practice to set it to the fully qualified domain name of the emitting host. This requires to have a SPF for that FQDN hostname in your DNS.

Note: The following holds for a single domain, just replace all occurrences of domainB with domainA. If domainA serves other domains, configure them similar to what is done for domainB.

For example suppose that the DNS for domainB.tld contains the following:

                       600 IN TXT    "v=spf1 mx -all"
                           IN MX     mx.domainA.tld

i.e. domainA hosts the SMTP server of domainB: mx.domainA.tld.

Then domainA DNS zone must contain a SPF record for host mx, along with the corresponding record that resolves to the IP address, for example:

mx                     600 IN TXT    "v=spf1 a -all"
mx                     600 IN A      A.B.C.D

then if myhostname references mx.domainA.tld you can let smtp_helo_name to its default value (i.e. myhostname) or you can configure it as needed.

Then reload postfix configuration (systemctl reload postfix).

postfixsmtpspfehlohelo