Re: Many email... and just one "mail" function
| From: | Steve Werby | Date: | Fri, 20 Apr 2001 13:24:30 +0000 |
| Subject: | Re: Many email... and just one "mail" function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49555@lists.php.net to get a copy of this message | ||
"Marian Vasile" <marian@investments.ro> wrote:
> Guyz I have a huge database wih emails.
> Now I want to send them news weekly and I can't.... how I can send many
> emails using mail() function ???
> but in a faster manner that ussualy ?... is that possible ?
>
> I'm not talking about SPAM here... I have registered users... :)
>
> How I can send all these 30.000 email addresses ?
With 30,000 users I recommend using a mailing list so your mail server can
do the heavy crunching. Since you probably run PHP as an Apache module and
I suspect your user database changes here are a couple of options to
consider.
1. Create a cron job to periodically pull the email addresses from the DB
and dump them into a text file that the MLM (mailing list manager) expects
(may require an additional step depending on your MLM).
2. Install PHP as a CGI and have it do the same as in option 1, but do
directly from your PHP script that sends the email. I say CGI so you can
make the script owned by any user you prefer and don't have to make the
directory containing the file world writable/readable.
If you choose not to go one of these routes you can try grouping email
addresses together (perhaps 50 at a time) and batch listing them in the bcc
header. You'll likely have to increase PHP's timeout setting in php.ini or
within the script itself. I don't recommend this method b/c it will be
*much* slower and you will not be able to take advantage of some of the nice
features of your MLM that you should really use for a list this large. FYI,
there are also methods for accessing SMTP directly (which avoids the mail()
function completely). I know there's a class at
http://phpclasses.upperdesign.com/ and there are
others elsewhere.
--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/