Hi there,
I have a mailing list script that i am using to send out an email to everyone on my database. The problem i am having is that my host will only let me send the email to 4 addresses at once and there is a limit of 500 per hour.
How can i make it so the script just sends out 4 emails at a time an no more than 500 an hour?
this is the code i am using:
[php]
<?php require('connect.php'); // Grab our config settings require_once($_SERVER['DOCUMENT_ROOT'].'/config.php'); // Grab the FreakMailer class require_once($_SERVER['DOCUMENT_ROOT'].'/include/MailClass.inc'); /* Note: set_time_limit() does not work with safe_mode enabled */ $result_message = ''; if (isset($_POST['submit'])) { $errors = array(); if (empty($_POST['email_addresses'])) { $errors['emails'] = 'No emails selected.'; } // here you can/should loop through and verify email addresses to avoid spamming; put a restriction to # of emails allowed to be sent, etc. // santizing/controlling your email functions is greatly overlooked and can cause your site to be dropped by your hosting provider if your site is being used to send gobs of spam if (empty($errors)) { $result_message = 'There was a problem sending this mail!'; // instantiate the class $mailer = new FreakMailer(); // Build foreach ($_POST['email_addresses'] as $email_address) { $mailer->AddBCC($email_address); } // Set the subject $mailer->Subject = 'New Products from The Organic Grow Shop'; $mailer->isHTML(true); if ($mailer->Send()) { $result_message = 'Mail sent!'; } $mailer->ClearAddresses(); $mailer->ClearAttachments(); } } $sql = "SELECT * FROM mailinglist"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result) > 0) { echo (!empty($result_message) ? $result_message .'' : ''); echo "
Mailing List
Send to"; while ($getrow = mysql_fetch_assoc($result)) { echo "". $getrow['email'] ."
"; } echo ""; } else { echo 'Add some email addresses.'; } } else { trigger_error(mysql_error()); } ?>[/php]