我想使用PHPmailer在while循环中向多个人发送电子邮件。但是一旦循环到达行include '../email/PHPMailerAutoload.php';
,它就会在while循环内停止。完整代码看起来像这样
<?php
$result = $con->prepare('SELECT * from table WHERE Date = ?');
$result->execute([$Date]);
while($row = $result->fetch(PDO::FETCH_BOTH)){
$Email=$row['Email'];
include '../email/PHPMailerAutoload.php';
email_function($Email);
}
?>
有什么想法吗?
答案 0 :(得分:0)
PHPMailerAutoload.php
必须包含/调用一次!请试试这个:
include '../email/PHPMailerAutoload.php';
$result = $con->prepare('SELECT * from table WHERE Date = ?');
$result->execute([$Date]);
while($row = $result->fetch(PDO::FETCH_BOTH)){
$Email=$row['Email'];
email_function($Email);
}