Good morning!
I have an email marketing system and I'm having trouble making a newsletter shot for a large list of contacts. (Understand large list as: a list containing over 1000 emails.)
If I take the shot for less than 1000 emails, shooting happens perfectly. If there are more than 1000, it does not send for everyone, even sending up to half the list.
I contacted Localweb, the server that hosts my accounts and where I authenticated SMTP, and they informed me that it could be a possible loss of packages during the sending.
My code looks in the database (SQL Server) within a for loop for all mail from the list that has been selected for the trigger and then sends it there. One consideration: sending is performed by a Cron Job that runs every 5 minutes.
Can anyone help me? Any idea what that might be?
My shipping code:
$mail = new PHPMailer();
$mail->setLanguage('br');
$mail->CharSet='utf-8';
$mail->IsSMTP();
$mail->Host = "xxx";
$mail->SMTPAuth = true;
$mail->Username = 'xxx';
$mail->Password = 'xxx';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->From = $email; (variável que vem do banco de dados)
$mail->FromName = $fantasia; (variável que vem do banco de dados)
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
for($z=0; $z<count($bcc); $z++){
if($html == '1'){
$topo = recebe um código html específico;
$rodape = recebe um código html específico;
$texto2 = recebe um código html específico, concatenando as variáveis $topo e $rodape - newsletter que será enviada;
}else{
if($topo == '1'){
$topo = recebe um código html específico;
$rodape = recebe um código html específico;
}else{
$topo = recebe um código html específico;
$rodape = recebe um código html específico;
}
$texto2 = recebe o código html específico, concatenando $topo e $rodape - newsletter que será enviada;
}
$mail->AddAddress($bcc[$z]['Email']);
$mail->IsHTML(true);
$mail->Subject = $tit; (variável vinda do banco)
$mail->Body = $texto2;
$mail->AltBody = $texto2;
$enviado = $mail->Send();
$mail->ClearAllRecipients();
$mail->ClearAttachments();
}