I'm trying to make the code pick up the emails I'm going to put in a .txt or a form list (while I'm not setting up the database) and loop to send all the emails. It turns out I'm getting this error message and I do not know how to fix the problem.
<?PHP
require_once('class.phpmailer.php');
$nm = $_GET['nome'];
$sb = $_GET['sobrenome'];
$address = "[email protected]";
$address = "[email protected]";
for($loop=0; $loop<4; $loop++){
$mail = new PHPMailer();
$body = file_get_contents('a.html');
$mail->AddReplyTo("[email protected]","EREA SSA");
$mail->SetFrom('[email protected]', 'EREA SSA');
// Nome e Sobrenome pegos através do GET "site.com/email.php?nome=André&sobrenome=Leal"
$mail->AddAddress($address[$loop], utf8_decode("$nm[$loop] $sb[$loop]"));
$mail->Subject = "Teste !";
$mail->MsgHTML($body);
//$mail->AddAttachment(""); // Arquivos para anexo
if(!$mail->Send()) {
echo "Erro: " . $mail->ErrorInfo . "<br/>";
} else {
echo "Mensagem enviada !";
}
$mail->clearAllRecipients(); // Limpa o campo de para quem o email será enviado e o nome
}
?>