Re: Proposal: Mail Handling, feedback requested
| From: | Gary Mort | Date: | Tue, 25 Mar 2014 22:38:36 +0000 |
| Subject: | Re: Proposal: Mail Handling, feedback requested | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-73434@lists.php.net to get a copy of this message | ||
On 03/24/2014 11:06 PM, Stas Malyshev wrote:
Hi!Thanks for the detailed feedback Stas! After thinking over your questions a bit, I realized that I combined multiple features into one item - and while I would like to see all those features in PHP, the primary issue is Mail Handlers. IE when a PHP program invokes: mail( $to, $subject, $message ); Instead of running the rough equivalent of exec('mail -s $subject $to < $message') the PHP engine should invoke a registered callable in the same manner as it currently handles errors, streams, and sessions. The default mail handler is merely the current mail handler. From a coding perspective, this means that there only needs to be a single extra function added: mixed set_mail_handler ( callable $mail_handler ) Providing a base MailHandler class along with some implementations would be best done with a seperate RFC to avoid confusion. The same with MailMessage. The only additional item I might place in the RFC would be possibly adding blackhole and maildrop callables as blackhole is extremely useful for development purposes and maildrop is a feature I have long lamented that no language seems to provide[when you have an app which generates and sends over a million emails in the course of a single day maildrop is the only way to maintain performance]Current e-mail handling in PHP is dreadful. Almost every framework implements it's own email handling class in order to make sending e-mail reliable, easy to configure, and to implement multiple mail schemes.That is probably because sending mail involves more than just passing a stream of bytes to SMTP server. There's MIME, encodings, headers, etc. which all need to be taken care of. There's email server configurations. There's error handling.