首页 > 编程 > PHP > 正文

php----phpEmailer 循环给每个用户发送邮件失败处理

2019-11-11 05:15:50
字体:
来源:转载
供稿:网友

封装方法:

public function sendEmail($sendEmailAddredd, $content, $formName = 'ABC科技集团', $title = '【重要】用户注册信息邮箱'){ // 加载库 require_once FRAMEWORK . 'mail/Mail.class.php'; // 需要用:require_once return Mail::send($sendEmailAddredd, $content, $formName, $title);}

调用:循环发送

foreach($emails as $k=>$v){ self::sendEmail($v['email'], 'test content' ); sleep(1);}

解决: 想确保它只被包含一次以避免函数重定义,变量重新赋值等问题, 需要require_once 方式引入 $mail对象被构造了两次,而phpmailer的对象不可以同时链接


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表