Click here to Skip to main content
15,926,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have some trouble here.

i m tying to send emails from my database where i have email column and in that column i have number of emails in there but when i try to insert more than 5 emails in my email column the Code i placed to send email is wouldn't be worked.one more thing i worked from 000webhost sever not on localhost.and using mail function.

here is my php file

<?php
if (isset($_POST['submit'])) {
  $text = $_POST['text'];
  $user_email = $_POST['user_email'];
  if ($user_email == '') {
    $select_id = "<h4><center>select your e-mail id first!</h4></center>";
  } elseif ($text) {
    $sql = "INSERT INTO senior_registered_post (user_id,text,date_time) VALUES ('$user_email','$text')";
    mysqli_query($db, $sql);
    $solution = mysqlI_query($db, "SELECT * FROM 
    senior_registered_users WHERE user_id='" . $_SESSION["user_id"] . "'");
    $row = mysqli_fetch_array($solution);
    $first_name = $row['first_name'];
    $subject = $row['subject'];
    $email = $row['email'];
    $email_list = "";
    $sql = "select email from email";
    $result = mysqli_query($db, $sql);
    while ($row = mysqli_fetch_array($result)) {
      if (!empty($row['email'])) {    //if email column is not empty
        $email_list .= $row['email'] . ",";
      }
    }
    $email_list = rtrim($email_list, ',');    //trim the rightmost ',' and remove it e.g abc,abd
    echo $to = "$email_list"; // add one by one email id and send it                                           
    $subject = "$subject";
    $header = "from:$first_name<$email>";
    $message = " $text  ";
    if (mail($to, $subject, $message, $header)) {
      echo "<div class='alert alert-success alert-dismissable fade in'>";
      echo"<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>";
      echo"E-mail send succesfully on registered E-mail Addresses";
      echo " </div>";
    } else {
      echo '<div class="alert alert-dismissable fade in">';
      echo '<a href="#" class="close" data-dismiss="alert" aria-label="close"</a>';
      echo '  Error! please Try After Sometime';
      echo '</div>';
    }
  } else if ($user_email == '') {
    $select_id = "<h4><center>select your e-mail id first!</h4></center>";
  } else {
    $textfield = "<h4><center>Please fill-out the Text fields first!</center></h4>";
  }
}
?>


What I have tried:

when i pressed the submit button if email column in my database contain more than 5 emails then its says Error! please Try After Sometime it's worked perfectly under <=5 email but more than that not.please if anybody have any idea were i am getting wrong please help i m new to php. any small help is appreciated.
Posted
Updated 29-Jul-17 6:14am
Comments
AdamASPGeek 17-Aug-17 23:56pm    
It's free hosting, right? With paid hosting, you are not allowed to send mass message, so how about free hosting? You can make conclusion

1 solution

Probably, it's to do with 00webhost: like most hosting services, they have no desire to be used as a mass marketing / spam / phishing delivery system, and limit how many emails you can send in a certain time period. As far as I can tell, the limit is 15 per minute: What is the email sending limit on 000webhost? | OngETC.com[^] but I don't use them so I can't be sure.
 
Share this answer
 
Comments
navjot singh 29-Jul-17 12:39pm    
thakyou sir its help alot!
navjot singh 29-Jul-17 12:42pm    
but in my case i cannot send more than 5 emails only as u said 15 emails!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900