Sending email to many people

0

I want to send an email to many people but it does not work when I try to send it to a 5 going. .Php code

    <?
            require('config.php');
    $sqlstt = "SELECT * FROM tb_site WHERE id='1'";
    $resultstt = mysql_query($sqlstt);   
    $rowtt = mysql_fetch_array($resultstt);

    $sitename = $rowtt['sitename'];
    $supmails = $rowtt['sitepp']; // E-mail Suporte.
    $supmail  = ""; // Envio do email.
    $nome_remetente = "Email Marketing $sitename";   
    $assunto = strtoupper($user).", E-Mail Marketing";
    $email_remetente = $supmails;
        // Inicio do envio de menságem para o usuário //    




        // Conteudo do e-mail (voce poderá usar HTML) //

        $mensagem = "
teste msg
        ";


        // Cabeçalho do e-mail. Nao é necessário alterar geralmente...


        $cabecalho =    "MIME-Version: 1.0\n";

        $cabecalho .=   "Content-Type: text/html; charset=iso-8859-1\n";

        $cabecalho .=   "From: \"{$nome_remetente}\" <{$email_remetente}>\n";

        $cabecalho .= "Bcc: [email protected]  \n";


        // Dispara e-mail e retorna status para variável


        $status_envio = @mail ($assunto, $mensagem, $cabecalho);


        // Se mensagem foi enviada pelo servidor…


        if ($status_envio)

        {  echo "Uma menságem foi enviada para o e-mail do usuário!<br />";

        }


        // Se mensagem nao foi enviada pelo servidor…


        else    {
            echo "Nao conseguimos enviar a sua menságem ao usuário!<br />";

       }


        ?>
    
asked by anonymous 19.07.2014 / 00:29

1 answer

1

Apparently the problem is not in your code. As said in the comments, it seems to be the limitation imposed by the server.

If you want to continue using your code and do not hire a mailing service, change it so that you send an X number of emails every hour. This number X must be equal to or less than the limit allowed by the server.

Add an information in the database to those recipients to whom you have already sent email, so in the next cycle you only bring the information that does not yet have this information recorded.

You can schedule cron (on Linux), or the Windows task scheduler, to run your script every 61 minutes, so you avoid blocking time.

Also check that your server blocks an accumulated volume for the day.

    
06.08.2014 / 20:12