SOLVED Server not using FQDN to send mail, being rejected

mathx

Member
Jan 16, 2017
23
3
3
Toronto
cPanel Access Level
DataCenter Provider
Server is using its hostshort name, not its FQDN to send email FROM and HELO. It's being rejected:

Code:
  host mx.*.com.cust.example.com [216.40.xx.x]
    SMTP error from remote mail server after HELO u202:
    504 5.5.2 <u202>: Helo command rejected: need fully-qualified hostname
How do I force it to use its full hostname? It's using it in the From header as well as HELO, despite /etc/mailhelo forced to be hostname -f, which works, and full forward and reverse is set ok.
 
Last edited by a moderator:

GOT

Get Proactive!
PartnerNOC
Apr 8, 2003
1,543
208
343
Chesapeake, VA
cPanel Access Level
DataCenter Provider
I suspect your hostname has reverted. You on a cloud provider? Google maybe? We see this a LOT with google.

Run the command

hostname

from ssh and see what it returns. If it just returns the first part of the hostname, that is your problem.

You can run this command:

whmapi1 sethostname hostname=host.domain.com
 

mathx

Member
Jan 16, 2017
23
3
3
Toronto
cPanel Access Level
DataCenter Provider
Hostname does indeed return just the hostshort, of course hostname -f works properly. On most unix hosts hostname just returns hostshort too though, so I didnt think much of it.

This isnt google cloud, but it is Proxmox 5.2 in an lxc container.

That command took a good 15 seconds to run, splatted out a buncha raw html about what it was doing, but now hostname returns the same as hostname -f.

And now mail from the cmdline from root as a test does indeed say <[email protected]> as it should.

Will test with clients. thanks!
 

mathx

Member
Jan 16, 2017
23
3
3
Toronto
cPanel Access Level
DataCenter Provider
I just ran into this again, figured it was our old Cpanel that was the problem. Nope, new Centos, new Cpanel, same problem. Note, this is lxc under proxmox 5.x, which does mess with startup settings/scripts.

So I've added

Code:
/usr/bin/whmapi1 sethostname hostname=host.domain.com
to /etc/rc.local, see if that forces it after a reboot. (and chmod +x /etc/rc.d/rc.local of course, since i should go to the trouble of making a proper systemd unit description but that's a pain, and systemd sucks)
 
Last edited: