here's the main chunk of code to show where I'm up to, using PHPMailer (v5) to allow sending out html emails to a database held mailing list
whilst it does actually work and I've experimented with the 'unsleep' element to adjust how quickly emails are sent out one after another I hit a not so slight snag with my hosting company temporarily suspending the account due to me overloading their server!Code:$result = @mysql_query($query); while (1==1) { set_time_limit(30); // sets (or resets) maximum execution time to 30 seconds) // .... put code to process in here if (!$result) { exit(mysql_error()); } while ($row = mysql_fetch_array ($result)) { $mail->Subject = "$subject"; $mail->MsgHTML($Header.$Body.$FooterStyle.$Footer.$Close); $mail->AltBody = $text_body; $mail->AddAddress($row['email'], $row['first'] . " " . $row['last']); if(!$mail->Send()) echo "There has been a mail error sending to " . $row['email'] . "<br>"; usleep(1000000); // sleep for 1 million micro seconds - will not work with Windows servers / PHP4 // sleep(1); // sleep for 1 seconds (use with Windows servers / PHP4 if (1!=1) { break; } // Clear all addresses and attachments for next loop $mail->ClearAddresses(); $mail->ClearAttachments(); } }
I'm guessing the set_time_limit(30) could be doing bad things, more so than the unsleep(1000000) but I'm not sure of the best way to send out what could be a few hundred emails in a safe and sensible manor - avoiding being labelled spam and / or annoying the hosting company.
Any suggestions?


LinkBack URL
About LinkBacks
Reply With Quote
