Sending email to many people

Asked

Viewed 375 times

0

I want to send an email to many people but it doesn’t work when I try to send to a 5 go. Code . php

    <?
            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 />";

       }


        ?>
  • Can you send to at least one or two people? If yes then this shouldn’t be a code problem. Most Mtas have well-defined rules about outgoing emails. Email marketing solutions generally use dedicated Mtas with more relaxed restrictions (simply so that emails can stop at the recipient’s side SPAM box :D).

  • I can send to 50 people more than that does not send have to change the limit?

  • You are looking to create email marketing campaigns or similar. When we are working with large volumes of emails there are several factors to consider besides the code itself (see this reply from Soen: http://stackoverflow.com/a/3860043/664577). Several factors may be limiting your upload, starting with the MTA output filters themselves as per my comment above.

  • In short, my advice here is to involve the infrastructure and network teams (you’ll need a privileged account to send mass emails, as well as a whole infrastructure preparation to not overload your servers). I also don’t recommend that you try writing something from scratch (it’s a lot of detail to think about), instead use one of the many existing tool options (Mailman, Swiftmailer, Phplist, Openemm, etc).

1 answer

1

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

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

Add information in the database to those recipients you’ve already emailed to, so in the next cycle you bring only those who don’t already have this information recorded.

You can schedule in cron (on Linux), or in the Windows task scheduler, so that it runs your script every 61 minutes, so you avoid the time lock.

Also check that your server blocks a volume accumulated during the day.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.