普通网友 2015-06-23 12:17
浏览 40

PHPMailer参数错误

Trying to send emails with multiple attachments using PHPMailer

require is fine $mail = new PHPMailer(); is fine script stops working when I start adding in the parameters for the mails.

PHP function :

function kamp_bulk_mail(){

require $_SERVER['DOCUMENT_ROOT'].'/assets/PHPMailer-master/PHPMailerAutoload.php';
require $_SERVER['DOCUMENT_ROOT'].'/assets/PHPMailer-master/class.phpmailer.php';           
$content = mysqli_fetch_array(sql('select','select * from kampen_mailtemplate where kamp = '.$_POST['id']));    
$spelers = sql('select','select * from kampen_spelers where kamp = '.$_POST['id']);
while($spelers_ = mysqli_fetch_array($spelers)){
    echo "1";           
    $mail = new PHPMailer(true);
    try {
    echo "2";           
    $mail->From("test@sender.be");  
    echo "3";       
    $mail->FromName("Admin");
    $mail->addAddress($spelers_['email_voogd']);        
    echo "4";       
    foreach(glob("kampen/configuratie/bijlagen/".$_POST['id']."_*") as $filename){      
        $mail->addAttachment($filename);
    }   
    echo "5";
    $mail->Subject = $content['titel'];
    $mail->Body = $content['content'];
    }
    catch(phpmailerException $e){
        echo $e->errorMesage();
    }
    if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}       

}   
}

This echoes 12

EDIT : adjusted code to show where the problem begins

  • 写回答

1条回答 默认 最新

  • douzong6649 2015-06-23 12:32
    关注

    try changing

    $mail->addAdress($spelers_['email_voogd']);    
    

    To

    $mail->addAddress($spelers_['email_voogd']);    
    

    Its just a typo I think

    Here is a list of all the method names

    评论

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改