Re: Re: SMTP vs mail()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

on 01/15/2008 01:41 PM Richard Lynch said the following:
>>>>>>> If you have your sendmail equivalent program properly
>>>>>>> configured,
>>>>>>> no
>>>>>>> SMTP connection is used when queueing messages using the
>>>>>>> sendmail
>>>>>>> program.
>>>>>> What about when you take into consideration this program could be
>>>>>> sending 1000's of emails, say, 100 per SMTP connection?
>>>>> That is even worse. Keep in mind that the SMTP server of sendmail
>>>>> or
>>>>> equivalent MTA, ends up calling the sendmail program for each
>>>>> individual
>>>>> message that it receives.
>>>> That would be the most brain-dead SMTP server on the planet...
>>>>
>>>> Are you talking Windows or something? :-)
>>> On the contrary, you may be surprised, but this is precisely inline
>>> with
>>> Unix/Linux spirit. Small programs communicating through pipes that
>>> execute individual tasks each and then exit. Unlike Windows, forking
>>> new
>>> programs is not so expensive.
>>>
>>> Anyway, you may want to check these diagrams to learn the
>>> architecture
>>> or sendmail and qmail and verify what I am saying:
>>>
>>> http://www.sendmail.org/~ca/email/sm-X/design-2005-05-05/main/node3.html#SECTION00310000000000000000
>>>
>>> http://www.nrg4u.com/qmail/the-big-qmail-picture-103-p1.gif
>> I can't see anywhere in that where it says a new process is spawned
>> for
>> each message. Sendmail is a beast but it's not that bad. I'm sure you
>> *could* configure it to do that, but you'd need to explicitly make
>> that
>> decision yourself.
>>
>> Where do you think it says that?
> 
> I suspect Manuel is confusing PHP's built-in mail() function which
> does spawn a new sendmail process for email function call with
> sendmail itself, which does not -- at least not unless you really work
> hard at it.

No, I am not confusing anything, I checked sendmail source, so I know
how it works.


> As to not configuring sendmail to queue/store/send-later, I guess that
> might still be the default, but it's a pretty stupid setup for mass
> email.

Right, AFAIK, only sendmail does that by default. Actually that is the
reason why it may seem slower to call the sendmail program from the
mail() function.

If you configure sendmail to not attempt to deliver the message when the
sendmail program is called, PHP does not have to wait and it is much faster.

Sendmail compatible programs like qmail and postfix do not even have
such options as they always inject the message in the queue and return
right away without having to wait for the delivery attempt.

Unfortunately, many Linux setups come with sendmail by default and it is
not configured to defer message delivery attempts by default. That is
why there is this misconception that using SMTP is faster than using
sendmail program directly to send messages to many recipients.

This is why in my MIME message class I have a function named
SetBulkMail() to tell the message delivery driver to optimize itself for
bulk mailing. In the case of the sendmail driver, it sets up several
options to avoid waiting for delivery attempts.

For SMTP relay deliveries, in case you have no choice, in bulk mail
mode, it avoids disconnections, despite we know this may work upto a
limit of recipients.

For Windows machines with Microsoft Exchange, in bulk mail mode it does
not use SMTP, but rather injects the message in the queue directly if
you have the necessary permissions.

As you may realize now this is a very mature class package that has been
optimized throughout the years to adapt to specific circumstances. For
that, I had to study each MTA and mail server to seek optimization
opportunities.

http://www.phpclasses.org/mimemessage

-- 

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux