I learned the hard way that if you don't set $myhostname to a FQDN you can quickly end up on a black list despite having valid SPF records. The documentation is IMO insufficiently clear that $myhostname MUST be fully qualified and that Postfix will NOT tack on $mydomain if no 'dots' are detected.
Sure, this could be chalked up to "stupid admin error" but doesn't it make sense to either warn about a short $myhostname during server startup and/or add code to smtp_proto.c before calling smtp_chat_cmd(session, "EHLO %s", var_smtp_helo_name) that if 2 dots are not found in $myhostname to automatically tack on $mydomain? I think all/most other cases of a short $myhostname are unlikely to cause mayhem, but during HELO it is major. I thought the valid_hostname() check in mail_params_init() would fault but it doesn't. Is the best solution then to extend valid_hostname() to actually check for at least 2 dots? I've generated a proposed patch. https://github.com/tb3088/postfix/commit/171c01607d9c4a0b819b5507502ca075ea0ae636 Aside, isn't the sense of this test backwards? https://github.com/vdukhovni/postfix/blob/eb73f242bb5ecd3ddf70142835e349c10a71c078/postfix/src/util/valid_hostname.c#L149
