getting 500 internet server error while using php email

For any other discussion relating to MailEnable.
Post Reply
Goinfory
Posts: 1
Joined: Thu May 28, 2015 8:15 am

getting 500 internet server error while using php email

Post by Goinfory » Thu May 28, 2015 8:20 am

Hi, i want to send email to my 600 clients through php email. but the loop works till 20 contacts, after that it show 500 internal server error. I am using http://hostforlife.eu server. Here is the script:
<?php
for($x=1;$x<=600;$x++)
{
$con = mysqli_connect("host","database","password");
if (!$con){die('Could not connect: ' . mysqli_error($con));}
mysqli_select_db($con,"database");
$sql="SELECT email FROM emails Where id = ".$x;
$result = mysqli_query($con,$sql);
$row = mysqli_fetch_array($result);
$to = $row['email'];
if ($to == "NULL")
{

}
else
{
echo $row['email'];
mysqli_close($con);
// mail($to,"subject","message");
sleep(2);
}
}
?>

Post Reply