【发布时间】:2016-03-15 20:05:00
【问题描述】:
我已经编写了一个代码,用于在控制器中向多个电子邮件地址发送电子邮件,但我想我写错了,我不确定我是否也在 forloop 的写入部分写了明确的电子邮件。抱歉,这可能是一个简单的问题,但我是这个领域的新人。
public function sendEmailforUnpaidInvoiceFromDB() {
//fetch tha data from the database
$this->load->model('invoice_page');
$foo = $this->invoice_page->getInvoicesForNotification();
$result = json_decode(json_encode($foo[0]), true);
foreach ($foo as $result){
$this->load->library('email');
$this->email->from('helloworld@hello.com', 'HELLO');
$this->email->to($result['Email']);
$this->email->subject('Pay Payments');
//$msg = $this->load->view('mypayment_view', '', true);
$this->email->message('your due date is '.$result['duedate']);
$returnvalue = $this->email->send();
if(!$returnvalue) {
alert("email failed to send");
} else {
// $uptArray = array('customer_notified_dt' => NOW());
//$this -> db -> update('invoice', $uptArray);
}
$this->email->clear(TRUE);
}
}
【问题讨论】:
-
你认为它为什么会出错?您收到任何错误消息吗?如果是,请在此处发布。
-
@ArthurGevorkyan 我添加了错误图片
-
现在您有更好的机会就您的问题寻求帮助!祝你好运,伙计。
标签: php codeigniter for-loop controller