0
how do I get all the img
with the foreach and send by email
, I put my function to send the email
inside the loop but it won’t send me only the first and if I put the function outside the loop it sends me the last someone could help me?
code
if(!empty($_POST)){
foreach($_POST['ck'] as $ck){
$msg = "<img src=\"http://www.site.com.br/images/$ck\"width=\"100px\" height=\"70px\"><br>";
// manda e-mail usuario
$mail = new PHPMailer();
$mail-> IsSMTP();
$mail->CharSet = "UTF-8";
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->Host = "smtp.zoho.com";
$mail->Username = "[email protected]";
$mail->Password = "senha";
$mail->SetFrom("[email protected]", "usuario");
$mail->AddAddress("[email protected]", "usuario");
$mail->Subject = "assunto";
$mail->msgHTML($msg);
if($mail->send()){
echo "enviado com sucesso";
exit();
}else{
echo "Erro ao enviar o email".$mail->ErrorInfo;
}
}
}
In an email you want to have multiple images or want an image by email?
– rray
in an email several img
– Leonardo Costa