PHP Classes

How to be faster

Recommend this page to a friend!

      SMTP E-mail sending class  >  All threads  >  How to be faster  >  (Un) Subscribe thread alerts  
Subject:How to be faster
Summary:not requireng to log in each time
Author:Ciprian Tudoran
Date:2007-01-31 00:37:14
Update:2007-01-31 01:13:50

  1. How to be faster   Reply   Report abuse  
Picture of Ciprian Tudoran Ciprian Tudoran - 2007-01-31 00:37:14
I am using your class (which is great, by the way) to send a lot of mails at once (news for members on my site). The problem is that the process is slow, because for each email address the script logs in to the smtp server, sends the message then logs out. then comes the next email address and the process is restarted. I use a "for" instruction to go through an array that stores the email addresses... is it possible to make so that the script logs in to smtp, sends all emails and then log out?

  2. Re: How to be faster   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-01-31 01:13:50 - In reply to message 1 from Ciprian Tudoran
The class authenticates when it connects. As long as you do not disconnect, you do not need to authenticate.

Anyway, SMTP relay is the slowest method to queue messages for delivery.

If you are using Linux, Mac OS X, Solaris or any other kind of Unix, you can use a MTA like sendmail or equivalent like qmail, postfix or exim, and drop the messages in the mail queue. On Windows you can drop messages in the MS Exchange pickup queue.

That is much faster than using SMTP because sendmail injects messages directly on the MTA queue, so you do not need to use TCP connection to communicate with SMTP server.

You can use any of these queuing methods with the MIME message composing and sending class. Just call the SetBulkMail function to optimize its behavior for mass mailing. Take a look at the test_personalized_bulk_mail.php example script.