phpmailer를 사용하여 대량 메일을 보낼 때 한 가지 문제가 없습니다.다른 데이터와 함께 데이터베이스에서 가져온 이메일 배열로 이메일을 보내려면 어떻게해야합니까?
$result = mysql_query("select * from $to",$conn) or die("list
selected ($to) does not exist ".mysql_error());
while ($row = mysql_fetch_array($result))
{
$email[] = $row['email'];
$student[] = $row['name'];
}
foreach ($email as $val => $uemail) {
$email = $uemail;
$students= $student[$val] ;
require("class.phpmailer.php");
$mail = new PHPMailer(true);
try {
$mail->AddReplyTo('[email protected]', 'My Name');
$mail->AddAddress("$email", "$student");
$mail->SetFrom('[email protected]', 'MyName');
$mail->AddReplyTo('[email protected]', 'My nameg');
$mail->Subject = "$sub";
$mail->MsgHTML("Dear $student<br> $msg <br>
<img src=\"$path\"> <p>
$host_upper
______________________________________________________
THIS IS AN AUTOMATED RESPONSE.
***DO NOT RESPOND TO THIS EMAIL****
");
$mail->AddAttachment("$path2"); // attachment
$mail->Send();
echo "Message Sent OK to $email </p>\n";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
}
어떤 도움, 제안을 이해할 수있을 것이다 :
여기 내 코드입니다.
감사합니다. 완전한 – kplus