php中批量发送邮件的问题

php中批量发送邮件的问题,php,ajax,email,Php,Ajax,Email,我正在设计一个通过phpMailer批量发送邮件的表单,例如,我想向50人发送邮件。但问题是在向10至15人发送邮件后,我的表单会给出一个文件未找到异常 下面给出了我的ajax调用 .on('success.form.bv', function(e) { e.preventDefault(); $('#send_email_next').modal({ backdrop: 'static'

我正在设计一个通过phpMailer批量发送邮件的表单,例如,我想向50人发送邮件。但问题是在向10至15人发送邮件后,我的表单会给出一个文件未找到异常

下面给出了我的ajax调用

.on('success.form.bv', function(e) {            
        e.preventDefault();     
        $('#send_email_next').modal({
                backdrop: 'static'
            });
        $.ajax({ 
                        type: "POST",
                        url: "email_next.php",
                        data: $("#emailform").serialize(),
                        success: function(html){ $("#modal_body").html(html);}
        });
    }); 
require_once("class.phpmailer.php");
require_once("class.smtp.php"); 
$mail = new PHPMailer();
$body=" ";
set_time_limit(0);
$mail->IsSMTP();
$mail->Timeout       =   10000;
$mail->SMTPKeepAlive = true;
$mail->SMTPDebug = false;
$mail->do_debug = 0;
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = 'tls';                 // sets the prefix to the servier
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 587;                       // set the SMTP port
$mail->Username   = $account_user_name;     // GMAIL username
$mail->Password   = $password;            // GMAIL password
$mail->From       = $account_user_name;
$mail->FromName   = 'Rayat Bahra Group';
$mail->Subject    = $_POST['subject'];   
$mail->AltBody    = ''; 
$mail->WordWrap   = 50; 
$mail->MsgHTML($body);
$mail->MsgHTML($content);
$mail->IsHTML(true); // send as HTML
$SN = 0;
$error_mail=0;
$total_mails_to_send = count($email_array);
foreach($email_array as $recipient_address)
{
$mail2 = clone $mail;
$mail2->MsgHTML($content);
$mail2->AddAddress(trim($recipient_address));
$status = $mail2->Send();
if($status)
{
    $SN++;
}
else{
    $error_mail = 1;
}
echo $SN." out of ".$total_mails_to_send. " sent <br>";
}
if($error_mail == 1)
    {
        echo "Message was not sent <br />PHPMailer Error: " .  $mail->ErrorInfo;
    }
else{

    echo "Message has been sent";
}
$mail->SmtpClose();
下面给出了在email_next.php中调用的Phpmailer函数

.on('success.form.bv', function(e) {            
        e.preventDefault();     
        $('#send_email_next').modal({
                backdrop: 'static'
            });
        $.ajax({ 
                        type: "POST",
                        url: "email_next.php",
                        data: $("#emailform").serialize(),
                        success: function(html){ $("#modal_body").html(html);}
        });
    }); 
require_once("class.phpmailer.php");
require_once("class.smtp.php"); 
$mail = new PHPMailer();
$body=" ";
set_time_limit(0);
$mail->IsSMTP();
$mail->Timeout       =   10000;
$mail->SMTPKeepAlive = true;
$mail->SMTPDebug = false;
$mail->do_debug = 0;
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = 'tls';                 // sets the prefix to the servier
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 587;                       // set the SMTP port
$mail->Username   = $account_user_name;     // GMAIL username
$mail->Password   = $password;            // GMAIL password
$mail->From       = $account_user_name;
$mail->FromName   = 'Rayat Bahra Group';
$mail->Subject    = $_POST['subject'];   
$mail->AltBody    = ''; 
$mail->WordWrap   = 50; 
$mail->MsgHTML($body);
$mail->MsgHTML($content);
$mail->IsHTML(true); // send as HTML
$SN = 0;
$error_mail=0;
$total_mails_to_send = count($email_array);
foreach($email_array as $recipient_address)
{
$mail2 = clone $mail;
$mail2->MsgHTML($content);
$mail2->AddAddress(trim($recipient_address));
$status = $mail2->Send();
if($status)
{
    $SN++;
}
else{
    $error_mail = 1;
}
echo $SN." out of ".$total_mails_to_send. " sent <br>";
}
if($error_mail == 1)
    {
        echo "Message was not sent <br />PHPMailer Error: " .  $mail->ErrorInfo;
    }
else{

    echo "Message has been sent";
}
$mail->SmtpClose();
require_一次(“class.phpmailer.php”);
需要一次_(“class.smtp.php”);
$mail=new PHPMailer();
$body=“”;
设置时间限制(0);
$mail->IsSMTP();
$mail->Timeout=10000;
$mail->SMTPKeepAlive=true;
$mail->SMTPDebug=false;
$mail->do_debug=0;
$mail->SMTPAuth=true;//启用SMTP身份验证
$mail->SMTPSecure='tls';//将前缀设置为servier
$mail->Host=“smtp.gmail.com”;//将GMAIL设置为SMTP服务器
$mail->Port=587;//设置SMTP端口
$mail->Username=$account\u user\u name;//GMAIL用户名
$mail->Password=$Password;//GMAIL密码
$mail->From=$account\u user\u name;
$mail->FromName='Rayat Bahra Group';
$mail->Subject=$\u POST['Subject'];
$mail->AltBody='';
$mail->WordWrap=50;
$mail->MsgHTML($body);
$mail->MsgHTML($content);
$mail->IsHTML(正确);//以HTML格式发送
$SN=0;
$error\u mail=0;
$total_mails_to_send=计数($email_数组);
foreach($email\u数组作为$recipient\u地址)
{
$mail2=克隆$mail;
$mail2->MsgHTML($content);
$mail2->AddAddress(trim($recipient_address));
$status=$mail2->Send();
如果($状态)
{
$SN++;
}
否则{
$error\u mail=1;
}
echo$SN.“$total_mails__to_send.”已发送的“$total_mails__send.”;
}
如果($error\u mail==1)
{
echo“消息未发送
PHPMailer错误:.$mail->ErrorInfo; } 否则{ 回显“消息已发送”; } $mail->SmtpClose();