Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74117 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77294 invoked from network); 10 May 2014 20:28:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 May 2014 20:28:46 -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.128.170 as permitted sender) X-PHP-List-Original-Sender: garyamort@gmail.com X-Host-Fingerprint: 209.85.128.170 mail-ve0-f170.google.com Received: from [209.85.128.170] ([209.85.128.170:50710] helo=mail-ve0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7F/A0-06448-CFB8E635 for ; Sat, 10 May 2014 16:28:45 -0400 Received: by mail-ve0-f170.google.com with SMTP id db11so7029788veb.29 for ; Sat, 10 May 2014 13:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=UYnZ3P3PIGBZ5QfE3V16i4LkiC0WQ9KaltLHahUvKgo=; b=c4SOu1XQ1ZhwLOiqZ1uIj3l4VDbksa/mfuVWdb3rRg0/6I4/hhTDf6U/PzyMOEjbe7 dR+YjEZlW1zXfZpSF7ZZLKlGifAvEy3B9Gg0jnTsQPIdQNn1INzrkIUrFaMvDM/4e7jl XLF5F1fDZf0XPc27fETysRLCUziBJMlxIUtljtEZ7/WofmUmp8q7efgiC1o90GTf+uQu TbpZBEDSlexValgOZ5T2ob0xRbZ9KAy4YJSDPHAO7UvQAFG4amg37Y1WoFIxMqieQSdQ I0jEs/DjCIwbfWAhVNFd3jXxn6Kc1hbPsUmFWg0hkQFEHmlhvcHTEs9Ackeba/a1Z6aM VHOA== X-Received: by 10.52.99.168 with SMTP id er8mr12244159vdb.26.1399753722045; Sat, 10 May 2014 13:28:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.58.182.72 with HTTP; Sat, 10 May 2014 13:28:01 -0700 (PDT) In-Reply-To: <533218C1.6010901@lerdorf.com> References: <5330E319.5060302@gmail.com> <5330F2B2.1030201@sugarcrm.com> <5331C238.6050409@gmail.com> <1395780660.9365.606.camel@guybrush> <53321455.7010907@gmail.com> <533218C1.6010901@lerdorf.com> Date: Sat, 10 May 2014 16:28:01 -0400 Message-ID: To: Rasmus Lerdorf Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=20cf3071cab060309404f9118f4d Subject: Re: [PHP-DEV] Proposal: Mail Handling, feedback requested From: garyamort@gmail.com (Gary Mort) --20cf3071cab060309404f9118f4d Content-Type: text/plain; charset=UTF-8 On Tue, Mar 25, 2014 at 8:01 PM, Rasmus Lerdorf wrote: > On 3/25/14, 4:42 PM, Gary Mort wrote: > > At the moment the mail() function is almost useless because it cannot be > > assumed work - on windows it is likely to generate an error. On Linux > > it depends on if sendmail/postfix/etc are configured. Make it a > > handler with a sane default setting and then it can be trusted. > > That's a pretty big leap there. In order combat spam, many places have > pretty tight restrictions on who and what can send mail. Outbound port > 25 is often blocked, for example, and the only way to send an email is > through a local smarthost MTA relay. And how exactly you need to connect > to that relay will vary from one environment to another. I don't see how > we can provide a default stream handler that "can be trusted" since it > needs the same level of local configuration attention as the current > mail() function. > True, I am not interested in providing a "better" default stream handler. What I'm interested in is that a developer can use mail() in the same way that they use fopen() and be reasonably confident that the function will work during execution. There has been a long exodus of using native PHP functionality and instead using methods exposed by frameworks to perform simple functions. While it made sense in the past, it leads to this weird skill gap where all the "learning PHP" tutorials aimed at beginners use built in functions and global variables such as $_GET, $_POST, etc And then "enterprise" applications have people use someFrameworkClass::mail(), someFrameworkClass::get(), etc. The silly thing is that these calls are almost exactly identical. $mail = someFrameworkMailClass(); $mail->send($to, $subject, $message); vs mail($to, $subject, $message); The primary difference being that the mail() function will /always/ function while creating a mail object of a particular type only works for that framework. So why not allow a framework to define it's own custom "mail handler" and override the current one? In the same manner that you can override a session handler or a stream handler. My goal is not to help the framework developer, their already dealing with the complexities. My goal is to help the developers who are going from beginner to experienced programmers in that they don't have to learn a lot of window dressing/new syntax to perform a simple function. Mail does partially support this concept. it supports using the sendmail_wrapper ini flag to designate an external program which handles all the mail processing. I just feel that it should be possible to do this internally as well - especially as it allows for more fine grained error checking. --20cf3071cab060309404f9118f4d--