正しい日である場合にのみ受信者に送信する電子メール送信リストをmysqlデータベースから作成しようとしています.1人ごとに個別の電子メールを送信したいのですが、全員が"To: "
現場にいれば問題ありません. これが私が持っていないものです
<?
$freq=date("N");
//get email address's
$result = mysql_query("SELECT * FROM email_list ");
while($row = mysql_fetch_array($result))
{
if($row['period']=="daily"){
$to="To: ".$row['name']." <".$row['email'].">\r\n";
$subject="Your exchange rate update";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .="To: ".$row['name']." <".$row['email'].">\r\n";
$headers .= "From: ME <me@me.com>" . "\r\n";
mail($to, $subject, $email, $headers);
}
if($row['period']==$freq){
$to="To: ".$row['name']." <".$row['email'].">\r\n";
$subject="Your exchange rate update";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .="To: ".$row['name']." <".$row['email'].">\r\n";
$headers .= "From: name <me@me.com>" . "\r\n";
mail($to, $subject, $email, $headers);
}
}
?>
メールは送信されず、エラー メッセージも表示されません。