title: Sending mass emails using PHP script, MySQL database
body: <p>I want to send mass emails using PHP mail function. Email addresses are stored in MySQL database. There are nearly 30k email addresses. I am sending one email at a time.</p>
  
  <p>60 emails are sent properly &amp; the next all emails are skipped. I am using godaddy host to send emails. Following is code I am using</p>
  
  <pre><code>&lt;?php 
  
  $con1=mysqli_connect("subscibe","subscibe","pw","subscibe");
  
  $subject = $_POST['subject'];        
  $message = $_POST['message'];
  
  $getusers = mysql_query("SELECT * FROM subscibe.emaillist");
  $email_from = "email@gmail.com";
  $headers = 'From: '.$email_from."\r\n".
  'Reply-To: '.$email_from."\r\n" .
  'X-Mailer: PHP/' . phpversion();
  
  while($result = mysql_fetch_array($getusers)) {
  
  $emailaddress = $result['Emailaddresses'];
  
  mail($emailaddress,$subject,$message,$headers);
  
  //Add email address to temp table
  $sqlq="INSERT INTO subscibe.temp VALUES ('$emailaddress')";
  
  if (!mysqli_query($con1,$sqlq)) {
  die('Error: ' . mysqli_error($con1));
  }
  }
  
  echo "Emails are sent"
  
  ?&gt;
  </code></pre>