[nycphp-talk] sending email from PHP
corey szopinski
corey at domanistudios.com
Thu Jun 3 13:19:39 EDT 2004
I¹m trying to build a tool to send dynamic emails (think order summary) from
PHP. I¹m running into very long delays waiting for sendmail to return a
result.
For example, a person submits an order, the function that handles the
transaction does a couple of things:
1. Sends an order confirmation to the store
2. Sends an order confirmation to the customer
The whole process can take over 1 minute, which times out the browser. I¹ve
tracked it down the delay to sendmail verifying the remote email address.
Since sendmail talks to the remote mail server in real-time, any network
lag, or DNS lag, causes the order process to hang. In my case, it does it
twice.
I¹ve looked at Pear Mail_Queue, and that looks interesting, but a bit
overkill. I¹ve also looked at going around the mail() function and opening
an SMTP socket directly to sendmail (same delays... in fact when I open a
session via command line, I can see the exact step in the SMTP conversion
where the lag happens)
Here¹s what I¹d like to do (and this would be helpful for anyone sending out
a modest volume of email)...
1. send the mail to sendmail
2. sendmail puts it into a queue
3. sendmail periodically checks this queue and sends the email.
Essentially, I¹d like to fork the slow lookup stuff to the background,
returning control the browser as soon as possible. This has the added
benefit of scaling to very large emails/hour since the browser never has to
wait for sendmail (or an external server) before a visitor can move on.
I¹m pretty sure that this is intrinsic to the way sendmail works, but most
of the documentation talks about the queue holding mail that¹s not
deliverable. What I¹d like to do is put to put a delay on the email before
it¹s processed by sendmail.
Any ideas?
-corey
DOMANI STUDIOS
Corey Szopinski
Technology Director
corey at domanistudios.com
70 Washington St. Suite 710
Brooklyn, NY 11201
718.797.4470 x116
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20040603/147fb9d1/attachment.html>
More information about the talk
mailing list