when a user submits a form in my website, a notification email will be sent to all active suppliers, which are 250 different suppliers. I used the mail() function for this, but sometimes users see internal server error when trying to submit the form and the emails are repeatedly sent. If different users try to submit the form at the same time, will it cause any problem? Can I set intervals between sending mails if so how? This is my code:
$emails = mysql_query('select * from supplier_detail where emailquotes = "y" and s_active ="a"');
while($row = mysql_fetch_assoc($emails)){
$to = $row['s_email'];
$headers = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
$headers .= 'From: mysitename <noreply@mysitename.com' . "
";
mail($to, $subject, $message, $headers);
}