• Resolved Martin Blumenfeld

    (@monkeypress)


    I was looking at our email logs and found that a bunch of messages were reporting the error “” does not match the expected structure for a DNS hostname, ” does not appear to be a valid URI hostname, ” does not appear to be a valid local network name

    In the /post-smtp/Postman/PostmanUtils.php file there’s a function called “getServerName” on line 484 that tries to get the server name from: $_SERVER[‘SERVER_NAME’]. The first if statement checks if $_SERVER exists and if it has a SERVER_NAME key, but it doesn’t check if the key actually has a value. In our case our server wasn’t setting the SERVER_NAME variable. This sounds like a pretty common issue. There’s a very similar function called “postmanGetServerName” on line 403 that also looks for the HTTP_HOST key, which did exist on our server. As a quick test fix I added “and $_SERVER[‘SERVER_NAME’]” to line 487. That change was able to get our emails going again. Have you seen a similar issue on other sites?

Viewing 1 replies (of 1 total)
  • Plugin Support M Aqib Khan

    (@aqibkhan9)

    Hello @monkeypress ,

    Thank you for sharing your findings in such detail, your analysis is very helpful, and I appreciate the time you took to investigate the behavior.

    Regarding the issue you observed with $_SERVER['SERVER_NAME'] being present but empty, we have not encountered this scenario on other customer sites so far. In typical environments, SERVER_NAME is populated consistently, as it’s part of the standard variables provided by most web servers.

    Your case appears to be specific to the configuration of your hosting environment, where SERVER_NAME is defined but not assigned a value. This isn’t common, but it can certainly happen in certain setups, especially behind proxies or custom server stacks.

    Your temporary fix of adding a check for a non-empty SERVER_NAME is logical and aligns with the fallback approach used in postmanGetServerName(). Since HTTP_HOST was available, that condition helped restore normal functionality.

    I appreciate you bringing this to our attention. While it doesn’t reflect a widespread issue, your feedback will help us improve the robustness of this function to better handle atypical server configurations.

    Warm regards,
    Support Team – WP Experts

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.