Speed of sending email .. can I put them in a queue rather than wait?

Speed of sending email .. can I put them in a queue rather than wait?

am 26.01.2010 05:02:18 von Angus Mann

------=_NextPart_000_052B_01CA9E90.2BFB7720
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all.

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?


------=_NextPart_000_052B_01CA9E90.2BFB7720--

Re: Speed of sending email .. can I put them in a queue

am 26.01.2010 05:19:11 von Paul M Foster

On Tue, Jan 26, 2010 at 02:02:18PM +1000, Angus Mann wrote:

> Hi all.
>
> 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?
>

If this were me, I'd set up a mailserver on the web machine and send
mail to it instead of using phpmailer to connect directly to a distant
mailserver. The authentication between phpmailer and the local
mailserver should be near instantaneous, and you can let the local
mailserver deal with transferring mails in its own sweet time. I don't
know if there's a mailserver included in XAMPP installations, but if so,
I'd do that. In fact, if you're just sending simple emails, you could
use PHP's built-in mail() function, which will connect directly to the
local mailserver without further configuration.

Paul

--
Paul M. Foster

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

Re: Speed of sending email .. can I put them in a queue rather

am 26.01.2010 11:35:25 von Eric Lee

--0016e68dec4701f4ea047e0ed856
Content-Type: text/plain; charset=UTF-8

On Tue, Jan 26, 2010 at 12:02 PM, Angus Mann wrote:

> Hi all.
>
> 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?
>
>
HI Angus,

+1 I agree on what Paul already said .
As in fact you were just to sent out low volume mails.
Create a table and queue all pending mails in that then use windows
scheduled tasks to perform the actual work
if that is not a real-time mail.


One thing to note, php on windows does't support specify username and
password.
But only hostname / IP Address and port only.


I can not help much
but just few more suggesions.

Hope these help

Eric,
Regards,

--0016e68dec4701f4ea047e0ed856--

RE: Speed of sending email .. can I put them in a queuerather than wait?

am 26.01.2010 14:39:47 von Bob McConnell

From: Paul M Foster
> On Tue, Jan 26, 2010 at 02:02:18PM +1000, Angus Mann wrote:
>>
>> I'm currently using the phpmailer class from phpmailer.worxware.com
>> to send datatbase -populated emails to clients.
>>=20
>> 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.
>>=20
>> The number of emails sent is very small. Each one is only sent after
>> a user fills out a form and presses send.
>>=20
>> 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.
>>=20
>> 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.
>>=20
>> Can anybody recommend a good way of doing this? Is Mercury Mail going
>> to help me here?
>>=20
>=20
> If this were me, I'd set up a mailserver on the web machine and send
> mail to it instead of using phpmailer to connect directly to a distant
> mailserver. The authentication between phpmailer and the local
> mailserver should be near instantaneous, and you can let the local
> mailserver deal with transferring mails in its own sweet time. I don't
> know if there's a mailserver included in XAMPP installations, but if
so,
> I'd do that. In fact, if you're just sending simple emails, you could
> use PHP's built-in mail() function, which will connect directly to the
> local mailserver without further configuration.

As another option, I have a simple SMTP script (Perl) that listens on
port 25, accepts all forwarded messages and appends them to a text file.
Since it doesn't actually do anything, it is all but instantaneous. I
use it as a black hole relay MTA for development and test servers that
can't reach the real world. If anyone is interested, let me know and I
can send you a copy. It is adapted from something I found via Google.

Bob McConnell

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

Re: Speed of sending email .. can I put them in a queue rather than wait?

am 27.01.2010 01:03:03 von Manuel Lemos

Hello,

On Tue, Jan 26, 2010 at 12:02 PM, Angus Mann 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.

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


--

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

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

Re: Speed of sending email .. can I put them in a queue rather than wait?

am 27.01.2010 02:32:11 von List Manager

Manuel Lemos wrote:
> Hello,
>
> On Tue, Jan 26, 2010 at 12:02 PM, Angus Mann 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

Re: Speed of sending email .. can I put them in a queue rather

am 27.01.2010 03:07:13 von Eric Lee

--00163623a9e16196c8047e1bdc1c
Content-Type: text/plain; charset=UTF-8

Hi, all

I'am doubted about installing a local mail server for just low volume
mailing.
May I ask all yours professional what do you think about it ?


Thanks in advanced.



Regards,
Eric,




> --
> 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
>
>

--00163623a9e16196c8047e1bdc1c--

Re: Speed of sending email .. can I put them in a queue

am 27.01.2010 03:35:57 von Paul M Foster

On Wed, Jan 27, 2010 at 10:07:13AM +0800, Eric Lee wrote:

> Hi, all
>
> I'am doubted about installing a local mail server for just low volume
> mailing.
> May I ask all yours professional what do you think about it ?
>

Every place I've ever hosted (all Linux servers) include a local MTA
which is up and running. In a large hosting operation, this local MTA
probably passes the mail for relay to a central MTA somewhere else in
the host's network. There are a variety of reasons for this. Among
others, it allows the hosting company to meter email and present a
single set of credentials to foreign (offsite) mail servers. And in
general, most hosting companies provide you with the location of the
local MTA, in case you need it for Perl, Python, cron or other scripts.
And PHP's mail() function will, by default, pass email to that local
MTA. And moreover, most (all?) Linux MTAs on boxes like this don't block
while they make connections. From the OP's description, it sounded like
his phpmailer() process was blocking while it made foreign connections.

Paul

--
Paul M. Foster

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

Re: Speed of sending email .. can I put them in a queue rather than wait?

am 30.01.2010 09:28:54 von Manuel Lemos

Hello,

on 01/27/2010 12:07 AM Eric Lee said the following:
> Hi, all
>
> I'am doubted about installing a local mail server for just low volume
> mailing.
> May I ask all yours professional what do you think about it ?

I do not use nor recommend Windows for delivering messages to many
recipients, but if you are stuck with it, maybe you can use Microsoft
Exchange in the same machine where PHP is running, you can drop the
messages in the mail queue pickup directory to avoid waiting for the
mail server to process them.

--

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

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

Re: Speed of sending email .. can I put them in a queue rather than wait?

am 30.01.2010 10:32:48 von Per Jessen

Angus Mann wrote:

> The number of emails sent is very small. Each one is only sent after =
a
> user fills out a form and presses send.
>=20
> 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.
>=20
> 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.

sendmail is your answer.=20


/Per

--=20
Per Jessen, Zürich (0.6°C)


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