Forum Replies Created
-
In reply to: Windows (Apache2/PHP/5.2.6/MySQL5.1.30)
Yes. What was I thinking?!? Unlike php.ini, the value can be specified in an optional bbPress configuration field (visible if SMTP is in use?) and set from a script, handling shared hosting environments as well.
Elegant solution. No plugin required.
In reply to: Windows (Apache2/PHP/5.2.6/MySQL5.1.30)1.0-alpha has the same issue, despite the heroic attempts made to scrub the mail headers. I would have done this sooner but I tend to avoid alphas, especially when I am new to a system.
Let me try to summarize again, hopefully more clearly, for future readers. The PHP mail() function (in Windows, and without ‘sendmail_from’ being set in php.ini) overloads the meaning of the ‘From:’ header argument to include the SMTP ‘MAIL FROM:’ command value (the one sent over the socket to the SMTP server) in addition to the normal meaning of the header: the email message body ‘From:’ header (the one that most people think of — the one displayed in the headers of messages in your email client that frequently includes a textual name as well as an email address).
Not only is the nature of this issue obscure (two meanings for seemingly the same header), but it is further muddied by the behaviour of PHP mail() on different platforms (Windows and non-Windows) and within Windows itself (with and without ‘sendmail_from’ being set in php.ini). The obscure and incomplete Note in the PHP mail() documentation does not help matters either.
So, without either PHP mail() changing (seems unlikely as this issue has existed for years) or without specific knowledge of Windows being added to clients (cough), the solutions are: 1) if PHP is under your control, set the ‘sendmail_from’ variable (server-wide) in php.ini (and it will be used as the value for the SMTP ‘MAIL FROM:’ command), or 2) if the client supports SMTP directly (bbPress does so with a plugin), use it, specifying two values for the ‘From’ header (the SMTP value must be a simple email address such as “me@example.com” while the other value may include a textual name and an email address, such as “Myself <me@example.com>”.
In reply to: Windows (Apache2/PHP/5.2.6/MySQL5.1.30)I see. So the preferred solution is to route anyone who wishes to use SMTP with bbPress, and is not happy with the default PHP behaviour, to use the SMTP plugin. Fair enough.
There is another solution for Windows SMTP systems for those who control PHP; live with setting ‘sendmail_from’ server-wide in php.ini. This overrides the value passed to the mail() function ‘From:’ header argument for use with the SMTP ‘MAIL FROM:’ command (where the problem lies), but retains that value for use with the mail message body ‘From:’ header (where a complete textual name may be used).
BTW, the reason that the (SMTP) MTA on Windows rejects the email address is not due to the MTA, but due to PHP on Windows:
http://www.php.net/manual/en/function.mail.php
A long-standing discussion is here:
http://bugs.php.net/bug.php?id=28038
The current value for the PHP mail() function ‘From:’ header (“User name” <uname@domain.com>”) is an RFC2822 compliant format suitable for parsing by a library (like PHP mail()) which *should* generate separate strings for SMTP (the ‘MAIL FROM:’ command, which must be RFC2821 compliant) and the message body (the ‘From:’ header field which can be RFC2822 compliant). RFC2821 format (user@domain.com or <user@domain.com>) differs from RFC2822 format. PHP mail() on Windows does not do this translation.
In reply to: Windows (Apache2/PHP/5.2.6/MySQL5.1.30)I was not referring to me modifying the core, but rather suggesting that the developers modify it for a future release of bbPress.
SMTP is a major mail API. It can be handled transparently by bbPress with the existing underlying PHP support of the ‘mail()’ function. Seems like a one line (and transparent to existing systems) change in bbPress would be preferable to requiring bbPress admins to discover the issue, debug it, and then find and install a plugin. It would have also prevented me (and judging from the forum topics, others) from spending our (and your) time on the issue as well. Perhaps I am missing something about the development and distribution of bbPress, but using a plugin for a 1 line change is putting a sledgehammer to a tack. Especially since a system presumably built for *nix systems goes into a Windows environment (and rather an unusual one at that; IIS being generally preferred to Apache in that world) rather well. Just my 2c worth.
In reply to: Windows (Apache2/PHP/5.2.6/MySQL5.1.30)Well, I suppose that would solve the problem, but ‘bb_mail()’ already calls PHP ‘mail()’ which transparently handles SMTP. No plugin required.
Yes, I know this requires a change to the core, but it is trivial and transparent.