On Sun, 2016-02-28 at 17:55 +0000, Dolf Schimmel wrote:
> Howdy,
> 
> I'm planning to create an RFC on this shortly, but would like to gauge
> the initial response first.
> 
> Currently whenever an email is sent through the mail() function it is
> sent by an invocation of a sendmail-compatible executable. However,
> there are scenario's in which an alternative transport than through a
> sendmail executable may be desired. For example when PHP has been
> locked down, preventing it from starting any executables. It would be
> nice if it would be possible to allow such an alternative e.g. through
> a PHP Extension. Of course there are many frameworks out there that
> setup an smtp connection themselves, but in a shared hosting
> environment it's unfeasible to tell users they can't use the mail()
> function.

For one: Why can't they use the mail function? A hoster can easily
provide a sendmail-compatible program doing whatever is needed in the
environment.
The purpose of the function is to get rid of mail reliably and quickly
in order to have it queued somewhere. PHP shouldn't be the MTA. That's
a tough task (i.e. what to do when the SMTP server is down or slow? -
PHP shouldn't have to wait)
So I'd like to learn where mail() can't be used (aside from a dev
desktop where this might need "too much" system configuration)


And as a side note: If you really have a special case where providing a
sendmail tool is no option you could easily create an extension
replacing mail() with a custom function (mbstring functions, runkit and
other extensions show how this can be done)

> The patch I'm proposing can be found here:
> https://github.com/php/php-src/pull/1778/files

I haven't fully reviewed this. But you're not handing extension
unloading. In some SAPIs we have dl() available and serve multiple
requests. Thus in one request a mail module could be loaded by dl() on
shutdown the extension will be unloaded, but the pointer will still
exist in the handler table.

johannes

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to