PHP을 사용하여 데이터베이스에서 여러 개의 전자 메일을 보내려면 도움이 필요합니다. 작동하는 코드가 있지만 이메일 하나만 허용 할 수 있습니다. 여러 사람을 보내도록 수정하는 방법이 있습니까? phpmailer를 사용PHP를 사용하여 데이터베이스에서 여러 개의 전자 메일 보내기
<?
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
//Gmail configuration
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the server
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "******@gmail.com"; // GMAIL username
$mail->Password = "785123nick"; // GMAIL password
$prize = "lol";
//End Gmail
$mail->From = "[email protected]";
$mail->FromName = "Jetstar";
$mail->Subject = "Order Redemption";
$mail->MsgHTML("You have bought " . $prize . " Print this and collect it at our office.");
//$mail->AddReplyTo("[email protected]","reply name"); //They answer here, optional
$mail->AddAddress("your-email","name to");
$mail->IsHTML(true); // send as HTML
if(!$mail->Send()) { //To see if we return a message or a value bolean
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
echo "Message sent!";
?>
일반적으로 웹 호스팅 회사에서는 1 분 안에 몇 개의 이메일 만 보낼 수 있습니다. 그래서 매 분마다이 작업을 수행하도록 cronjob을 설정해야합니다. – machineaddict