Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73434 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71146 invoked from network); 25 Mar 2014 22:38:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Mar 2014 22:38:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=garyamort@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=garyamort@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.44 as permitted sender) X-PHP-List-Original-Sender: garyamort@gmail.com X-Host-Fingerprint: 209.85.192.44 mail-qg0-f44.google.com Received: from [209.85.192.44] ([209.85.192.44:48780] helo=mail-qg0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 75/82-55219-17502335 for ; Tue, 25 Mar 2014 17:38:41 -0500 Received: by mail-qg0-f44.google.com with SMTP id a108so3112151qge.3 for ; Tue, 25 Mar 2014 15:38:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=IIoegTEkEvtVOHg4qNSbuKDOw3fr1S6gpBrWi6Aa+Mc=; b=rW0PuzLQ2pTXktQqwBY2bv2RfJ8JvrDWtmloS90rfIvG1PXDQUQFohi+UoNIzpTEY7 l/m/OTI0j2YxmwzhCvoY5j9keJz7wKM5BLrkqmIQ9nh8WiyD7V5jFyU6mPDlx376lPSC UdysoEkvhqDmv+5tRH0UAZ4GQe10m/vdUQ3Ib92FAdwdOHpgvjmpv+zJ3wrSzird4Ayo jNjyDZqMR3BsujjkuxYX8xeiFDbtSxK/yTKUc6Cm9tQdwxMuvhprgq/suOUuh3dmG7Sm P+o5ciTae9w267ZfRpq4ujYMjAopYm/xpCceRdA88tjSjV0AGqluSC7+d6lvPYc/qhMt hlHQ== X-Received: by 10.224.167.80 with SMTP id p16mr86373118qay.62.1395787118865; Tue, 25 Mar 2014 15:38:38 -0700 (PDT) Received: from ?IPv6:2604:2000:1118:4036:62a4:4cff:fea8:603d? ([2604:2000:1118:4036:62a4:4cff:fea8:603d]) by mx.google.com with ESMTPSA id s61sm29428793qge.11.2014.03.25.15.38.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 15:38:38 -0700 (PDT) Message-ID: <5332056C.2040101@gmail.com> Date: Tue, 25 Mar 2014 18:38:36 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: "internals@lists.php.net" References: <5330E319.5060302@gmail.com> <5330F2B2.1030201@sugarcrm.com> In-Reply-To: <5330F2B2.1030201@sugarcrm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Proposal: Mail Handling, feedback requested From: garyamort@gmail.com (Gary Mort) On 03/24/2014 11:06 PM, Stas Malyshev wrote: > Hi! > >> 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. 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]