Quantcast
Channel: smtp – WordPress.org Forums
Viewing all articles
Browse latest Browse all 2272

Kubernetes / Server Hostname empty when sending email

$
0
0

Hey there,

I had an issue where my Kubernetes/Docker container was unable to send emails through SMTP, because of the infamous “does not match the expected structure for a DNS hostname”.
It is due to the fact that the PostmanUtils::getServerName() method uses $_SERVER['SERVER_NAME'] as long as it is defined, regardless of whether or not the value is empty (string(0) "").

I fixed it by changing line 452 of Postman/PostmanUtils.php to:

if (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) {

(adds an empty check on the value). It then figured the proper container hostname.

If this was on GitHub, I’d have done a pull request but… Well, it’s been a while since I’ve used SVN, so it would be nice if someone can add that to the repo so that my manual change isn’t overridden on the next plugin update 🙂 It shouldn’t affect any existing install.


Viewing all articles
Browse latest Browse all 2272

Trending Articles