0
I’m trying to get the code to take the emails I’m going to put on a list. txt or in a form (while not assembling the database) and make a loop to send all emails. I happen to be getting this error message and don’t 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
}
?>