Re: SMTP vs mail()

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

 



Hello,

on 01/11/2008 02:33 PM Stut said the following:
> Richard Heyes wrote:
>> Bearing in mind I haven't yet done any benchmarks, which do you think
>> is faster - SMTP with multiple RCPT commands or the PHP mail()
>> function (with it launching a separate sendmail process for each
>> mail() function call)?
> 
> No brainer, SMTP will almost certainly be faster. My mailing list system
> (written in PHP obviously) can dump 600k customised emails to the local
> SMTP server in a couple of hours. Doing the same with the mail command
> took over 24 hours. How much slower will depend a lot on how you have
> configured sendmail, but it's never going to be faster than a socket
> connection to the local SMTP server.

That is not true. SMTP connections are much slower than calling the
sendmail program because calling sendmail uses pipes to communicate and
SMTP requires an TCP connection, even if it is to the same machine.

Your problem is that you have sendmail in the default configuration,
which makes it attempt to deliver the messages when you call it. That is
why it was taking too long to send all your messages.

You need to configure it to queue the messages locally, instead of
attempting to deliver right away.

One solution is to use a better MTA like qmail or postfix.

If you are stuck with sendmail and you cannot change its default
configuration, there are some options to configure it per delivery.

Take a look at this message composing and sending package class. It
provides some options to optimize the message delivery back end to speed
up message queueing. The sendmail backend takes great advantage of these
options. Take a look in particular at the script
test_personalized_bulk_mail.php .

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