Re: How to implement mass emailing?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Well, you do have a number of options. First, as someone suggested, you can write a CLI script that doesn't depend on a web browser being connected to run. That's probably the best solution overall, because you have the most control over what happens. You can even trigger it indirectly through a call to a web page.

If you want to run the script through the web, you can set_time_limit(0) to prevent your script from timing out and register_shutdown_function() to ensure that your script continues running even if the user terminates the connection from the browser. Because of this, though, you will also need a mechanism that makes it possible for the script to determine whether there is another instance of the script running, so that you can prevent an overanxious usre from refreshing your script multiple times because he can't tell that it's still sending out mail and hit your mailing list more than once.

Finally, you will need a fast mailing mechanism. mail() is not your only option--you can interface directly with any mailer through SMTP or pipes, for example--but in my experience, you don't need to go any further to make things work properly. What you really need, is a fast MTA that is capable of queueing your messages and deliverying them efficiently, like qmail. If you want an easier way of composing e-mail programmatically, you may want to take a look at PHPMailer (http://phpmailer.sourceforge.net/), which can simplify things significantly and can also interface directly with a fast MTA like qmail.

We use a combination of these techniques to send out tens of thousands of notifications once every month, and never had a problem with it.

HTH,


Marco Tabini

--
php|architect
The PHP Magazine for PHP Professionals
http://www.phparch.com

Tumurbaatar S. wrote:
The scenario is:

1. Site administrator logs into his admin page and writes
some message on a form.
2. After clicking submit the web script should broadcast
this message to several hundred subscribers.

And I'm wonder how to implement this on PHP.
Sending an email to each subscribers can take
a much time and PHP will stop after max_execution_time.
Any ideas?



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux