Hello,

On 12/02/2003 07:50 PM, Pablo Gosse wrote:
Hi all.  I'm curious as to the performance difference between scripts
that use sendmail vs. smtp for their mailing abilities.



I use the following class for delivering emails,
http://phpmailer.sourceforge.net <http://phpmailer.sourceforge.net/> ,
and since I don't have sendmail running on my local machine I'm using
the smtp server of the university where I work to deliver my messages.
However, it seems to be a bit sluggish.



I'm going to run a test of switching the mail handler from smtp to
sendmail once the application is in its permanent home in a few weeks,
but for now does anyone have any opinions on this, and is there any
advantage to using one over the other?

Forget SMTP. There is a myth that SMTP is faster than queuing message via sendmail but that is just a reflex that some people do not understand how it works.


What you need to understand is that sending messages usually consists on two things: queueing and deliverying.

Usually you do not deliver messages directly to the end recipient. You just pass them to a MTA (Mail Transfer Agent) that will take care of the delivery.

When you you pass the message to sendmail program, depending on it may be configured, it may either try to deliver the message immediately and return when it is done, or just leave the message on the local queue for later delivery.

When you relay the message to a SMTP server, usually it just queues the message there for later delivery.

Obviously, if you use sendmail and it tries to deliver the message immediately, it will take eventually a little more time, but the message is already delivered. If the message is queued for later delivery, your PHP script does not have to wait so much but the message may take much longer to be deliver.

Even if you just want to queue the messages for later delivery to free your PHP scripts, sendmail can do it much faster because you will be using local interprogram communication to injec the message in the local queue. If you do it via SMTP server, you need to establish a TCP connection which is much slower even when the SMTP server is in the same machine.

If you just want to free your PHP scripts and leave messages in the queue, what you may need to do is to pass sendmail the appropriate switches to tell it to do it so.

For that, you can check sendmail documentation to see the available modes, or you may want to try this e-mail message composing and sending class that has sub-classes specialized in delivering via mail() function, sendmail, qmail and SMTP.

The sendmail subclass provides options that translate to the appropriate sendmail switches. For faster queueing, set the delivery_mode variable of the sendmail_message_class to SENDMAIL_DELIVERY_DEFERRED .

If you can have a qmail MTA in your machine, use qmail because it is by far the most efficient.

http://www.phpclasses.org/mimemessage

--

Regards,
Manuel Lemos

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



Reply via email to