i have a problem. I have created this code:
//Include Required PHPMailer files.
require_once '../php/phpMailer/PHPMailer.php';
require_once '../php/phpMailer/SMTP.php';
require_once '../php/phpMailer/Exception.php';
//Define Namespaces.
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
//Create Instance of PHPMailer.
$mail = new PHPMailer();
//Set Mailer to use SMTP.
$mail->isSMTP();
//Define SMTP Host.
$mail->Host="ssl://smtp.gmail.com";
//Enable SMTP Authentication.
$mail->SMTPAuth="true";
//Set type of Encryption (ssl/tls).
$mail->SMTPSecure="ssl";
//Set Port to connect SMTP.
$mail->Port=465;
//Set Username of Gmail.
$mail->Username="PRIVACY";
//Set Password of Gmail.
$mail->Password="PRIVACY";
//Set Sender of Email.
$mail->setFrom("PRIVACY");
//Enable HTML.
$mail->isHTML(true);
$arrayEmails = explode("\n", file_get_contents('PRIVACY'));
unset($arrayEmails[count($arrayEmails)-1]);
//Set Subject of Email.
$mail->Subject=$_POST['titolo'];
//Body of the Email.
$mail->Body=$_POST['inviaNewsletter'];
$listOfEmail = array();
for ($i=0; $i<500; $i++) {
//Add Receiver.
$mail->AddBCC($arrayEmails[$i]);
if ($i % 100 == 0) {
//Send Email.
$mail->send();
$mail->clearAllRecipients();
}
array_push($listOfEmail, $arrayEmails[$i]);
}
//Send Email.
$mail->send();
$mail->clearAllRecipients();
//Closing SMTP Connection.
$mail->smtpClose();
echo print_r($listOfEmail);
this code works but after the first sending of the first 100 emails, it does not continue further. Why? Have you encountered the same problem by any chance? Why doesn't it allow me to send 500 emails? if what I am trying to do is not possible, do you know a method to send 8,000 emails from my private server to the emails of my subscribers? I don't want to use external services so as not to spend more money. With this method, it seems that google is not reporting me as spam.