我无法在000webhost上发送超过5的电子邮件

时间:2017-07-29 15:01:52

标签: php database email mysqli

我在这里遇到了一些麻烦。

我想从我的数据库发送电子邮件,我有电子邮件列,在那一列我有很多电子邮件,但当我尝试在我的电子邮件栏中插入超过5封电子邮件时,我发送的电子邮件代码是我的工作更多的是我从000webhost服务器上工作而不是在localhost.and使用邮件功能。

这是我的php文件

<?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'>&times;</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">&times;</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>";
  }
}
?>

当我按下提交按钮时,如果我的数据库中的电子邮件列包含超过5封电子邮件,则说明错误!请尝试一段时间之后它在&lt; = 5电子邮件下工作得很好但不止于此。如果有人有任何想法,我会出错,请帮助我新的PHP。 感谢任何小帮助。

0 个答案:

没有答案