mail() sending local hostname instead of fully-qualified hostname as HELO
| From: | Rick Yorgason | Date: | Sat, 20 Jun 2009 02:06:13 +0000 |
| Subject: | mail() sending local hostname instead of fully-qualified hostname as HELO | ||
| Groups: | php.internals.win | ||
| Request: | Send a blank email to internals-win+get-512@lists.php.net to get a copy of this message | ||
I just discovered that the Windows version of mail() sends the local
hostname instead of the fully-qualified hostname as the HELO parameter.
It turns out this is a really old bug[1], and at the time it was
dismissed as being a bug in Windows, rather than a bug in PHP.
I just wanted to point out that it's not actually a bug in Windows,
since the official documentation for Winsock[2] clearly states that the
name that the function returns "can be a simple host name, or it can be
a fully qualified domain name." The error here seems to be that the
devs expected the function to act identically to the POSIX function of
the same name. Actually, while the name returned by gethostname() is
*usually* a FQDN on a POSIX machine, I don't actually think it's guaranteed there, either.
I know this is a long shot, but is there any way the 'bogus' status
lifted on this bug? I know it's frustrating that Winsock is
not-quite-compatible with POSIX, but this behaviour *is* fully
documented, and there *are* ways to get Winsock to return the FQDN.
(One of those ways is even listed in the bug report! Granted, that's in C. An easy way to do it in pure PHP is, instead of just calling gethostname(), call gethostbyaddr(gethostbyname(gethostname())).)
Thanks,
-Rick-
[1] http://bugs.php.net/bug.php?id=38091
[2] http://msdn.microsoft.com/en-us/library/ms738527(VS.85).aspx