Manuel Lemos wrote: > Hello, > > On Tue, Jan 26, 2010 at 12:02 PM, Angus Mann <angusmann@xxxxxxxxx> wrote: >> I'm currently using the phpmailer class from phpmailer.worxware.com to >> send datatbase -populated emails to clients. >> >> At the moment I'm runninng PHP on Windows and using the built-in sendmail >> equivalent packaged with XAMPP. It uses a remote SMTP that authenticates by >> prior logging into a POP account. >> >> The number of emails sent is very small. Each one is only sent after a user >> fills out a form and presses send. >> >> But there is a noticable lag of about 5 or sometimes 10 seconds after >> pressing "send" before the user sees the "Mail sent" page. I presume the >> reason for the lag is the time spent logging on and off a remote POP, then >> SMTP server, transferring the data etc. >> >> It would be better if this happened in the background - that is, the user >> could get on with doing his next task while the emails sat in a queue in the >> backgorund, being lined up and sent without PHP waiting for the process to >> finish. >> >> Can anybody recommend a good way of doing this? Is Mercury Mail going to >> help me here? > > The problem is that you are using Windows. Windows is a weak platform > for what you are doing as it lacks of free solutions like those you find > in Linux or any other Unix like OS. > > Under Linux practically every MTA has a queue. All MTAs queue messages > by default instead of sending the message right away, except for sendmail. > > That is way faster than having your application to send messages to your > MTA by SMTP as you are doing. > I agree that using a local MTA is somewhat faster then using a remote SMTP server, but I would have to say that the performance issue that he is reporting would be noticed by all that used remote SMTP servers if it were such a significant difference. I would argue that he needs to audit his code a little more. What he said was that the entire process from hitting the send button to showing the "Mail sent" page took that long. He said "I presume the reason for the lag is the time spent logging on and off a remote POP, then SMTP server, transferring the data etc." I would suggest that he find out if it is or not. I would like to see proof that it is this portion of the script that is causing the slowness before suggest he change his server platform. He mentioned pulling data from a DB and generating the email dynamically. Maybe it is the DB that is causing some lag because of a badly structured SQL call. Maybe it has to do with the size of the data that he is requesting from the DB. Could it be the amount of data that he is submitting through the form? I would suggest that he try and replicate the process with the simplest of code. Even as far as removing the DB portion and sending hard coded data instead of stuff pulled from the db. Simply enough, I would have many things that I would suggest trying before telling someone to replace their OS. Just my 2cents... > If you are really stuck with Windows, if you can use Microsoft Exchange, > you may use a faster solution. Exchange has a local pickup queue > directory. You just write messages in that directory and leave them > there. PHP does not need to wait for any delivery. Exchange will pickup > the messages ASAP and deliver them. > > This is explained in this presentation. Jump to slide 11. > > http://www.phpclasses.org/browse/video/3/package/9.html > > If you want to use this solution, the MIME message package has a driver > class for queueing messages in Exchange pickup queue directory . Take a > look at the test_pickup_message.php example script. > > > http://www.phpclasses.org/mimemessage > > -- Jim Lucas NOC Manager 541-323-9113 BendTel, Inc. http://www.bendtel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php