The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

getting 500 internet server error while using php email

Discussion in 'General Discussion' started by Goinfory, Jun 4, 2015.

  1. Goinfory

    Goinfory Registered

    Joined:
    Jun 4, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    London
    cPanel Access Level:
    Website Owner
    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 - Removed - server. Here is the script:

    Code:
    <?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);
    }
    }
    ?>
    
    
     
    #1 Goinfory, Jun 4, 2015
    Last edited by a moderator: Jun 5, 2015
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page