I am running a mailing list in which I need to send a mailing to my members each night. Currently, I am getting the info from the Database, and looping through the results using mail() inside the loop to email each member. Right now, the list size is about 100,000 members, and growing rapidly.

I have a dedicated dual pentium 1000mhz with a gig of ram, but the mailing just doesn't send fast enough. If I remember correctly, I read something in the past about the PHP
mail() function not being very good to do what I need to. However, it's imperative that I include member information within the email, such as username, password, etc, and none of the Bulk Email software I have found is capable of this.

Does anyone have any suggestions as to what I should do? Are there any options that use PHP?

    This is going to sound really weird, but I don't care how slow it goes, I just need to e-mail about 6,000 list members and when I try to do it, it either times out or gives me this funky error message in a pop-up window. How are you getting it to e-mail your 100,000 without getting an error? Any bone you could throw me would be well appreciated 🙂

      Well, for one, I have only one site running on the server, which is a very fast and powerful server. Second, I tweaked the timeout of PHP to 5 mins instead of 30 seconds. Inside the while() loop, right after I call the mail() function, I also output data as to which line, so if the mailing stops in the middle, I know exactly where it left off, and I have the ability to start again where it left off.

        i noticed same problems with mail() function. i guess that mail server is trying to resolve each destination domain what tooks a long time! -- is there a way to prevent this?

        i havent found a perfect solution yet [like you said, the script timeouts, etc] but i do have a solution that works well even for LOTS of emails.


        1. set timeout in your php script to something big, like 3600*24 == one whole day :-)

        2. instead of running your script from the browser, go to console and run it with lynx:

        lynx -dump http://domain.com/myscript.php &

        & will put the process it in the background... log off and enjoy... everything will be fine, even it it take 10 hours, no problem, it works.

        any better solutions?

        Matjaz

          I suggest using php to make a file with all the mails in them, and then writing a perl script or command line php script that will feed them into qmail-inject or sendmail or whatever you use. 100 000 members is a lot, if I were you I'd look into writing a dedicated perl script that gets the user info from the database, makes the mails, and sends them so that you can run the script from cron and don't have to worry about php timeouts and such.

            It's actually not PHP timeouts that are my problem...it's more of a SendMail issue. I have tried everything to tweak sendmail on the server as well, so I'm thinking it's probably not so much of a PHP/PERL question, but more of a SendMail one. I've read all the docs there is about SendMail, and I just haven't found what I needed. I was just hoping someone else had some input as to the best way to accomplish this =)

              10 months later

              I've also beeen trying to do this but can never get each users individual details out on each email. This is what I have so far :-


              //loop customers

              $mailheaders="From: team@studio-51.co.uk\n";
              $mailheaders .= "Reply-To: team@studio-51.co.uk\n";
              $mailheaders .= "Content-Type: text/html\n";

              $getcustomers = mysql_query("SELECT * FROM customers");

              while ($customer = mysql_fetch_array($getcustomers)) {
              eval ("\$content = \"$content\";");
              print "$content<br>";
              mail($customer[email], $subject, $content, $mailheaders);

              }

              $content is jsut a text filed filled out on a previous form easy right? Well it only seems to eval it once and I just get the first memebers details printed into the $content variable. Anyone know how to fix it? Thanks guys

                Write a Reply...