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>";
}
}
?>
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.
the code is successfully worked it fetches the all emails from database and send the email individually.but only send if emails addresses in the database column <=5
i have a comment box and i have a table in the database were i put all the emails in a column now i wanted to send the email to all my recipients what ever i typed in that commentbox
I have managed to send test e-mails from both your websites without problems. Our mailing nodes are not down, which means the problem is either from your code or from your e-mail provider.
Also, I have noticed that the content of website https://kindelcryon.000webhostapp.com/ is in contradiction with our Terms of Service.
We do allow you to send e-mails from our servers, however we do not allow you to send spoofed e-mails for spamming/scamming purposes or such. Please remove the forbidden content of that website within 24 hours, otherwise your account will be suspended without recall.