我有一個笨的形式類似如下:笨電子郵件沒有被髮送
當我點擊綠色的檢查標誌爲「批准」或「拒絕」的紅十字標誌,一個電子郵件應該被髮送到某些地址。但我已經檢查過郵件從未發送過。
爲了更好地理解,下面是我的一些代碼:
查看:
<td class="center">
<?php
$edit_text = (ACTION_BUTTON_TEXT_SHOW) ? 'Approve' : ' ';
echo anchor('staff_requisitions/update_approve/' . $row['id'],"<img src='".base_url()."/media/images/accept.png'>", $edit_text, array('class' => 'edit_button', 'title' => 'Approve'));
?>
</td>
<td class="center">
<?php
$edit_text = (ACTION_BUTTON_TEXT_SHOW) ? 'Reject' : ' ';
echo anchor('staff_requisitions/update_reject/' . $row['id'],"<img src='".base_url()."/media/images/reject.png'>", $edit_text, array('class' => 'edit_button', 'title' => 'Reject'));
?>
</td>
控制器:
function __construct()
{
parent::__construct();
$this->load->database();
$this->load->model('Staff_requisition');
$this->load->helper('url');
$this->load->helper('html');
$this->load->helper('form');
$this->load->library('email');
$this->output->enable_profiler(false);
}
function update_approve(){
$id = $this->uri->segment(3);
$this->Staff_requisition->update_approve($id);
//$data['list_of_emails'] = $this->Staff_requisition->get_list_of_emails($id);
$this->email->from('[email protected]', 'Joshamee');
$this->email->to('[email protected]');
$this->email->cc('[email protected]');
$this->email->subject('Email Test');
$this->email->message('Testing the email class. Your requisition approved.');
$this->email->send();
echo $this->email->print_debugger();
$this->session->set_flashdata('message', 'The requisition request has been approved');
redirect('staff_requisitions/index');
}
function update_reject(){
$id = $this->uri->segment(3);
$this->Staff_requisition->update_reject($id);
//$data['list_of_emails'] = $this->Staff_requisition->get_list_of_emails($id);
$this->email->from('[email protected]', 'Joshamee');
$this->email->to('[email protected]');
$this->email->cc('[email protected]');
$this->email->subject('Email Test');
$this->email->message('Testing the email class. Your requisition rejected.');
$this->email->send();
echo $this->email->print_debugger();
$this->session->set_flashdata('message', 'Sorry, the requisition request has been rejected');
redirect('staff_requisitions/index');
}
型號:
function __construct()
{
parent::__construct();
}
function update_approve($rid){
$this->db->query("UPDATE `staff_requisitions` SET `is_approve` = 1 WHERE `id` = $rid ");
}
function update_reject($rid){
$this->db->query("UPDATE `staff_requisitions` SET `is_approve` = 0 WHERE `id` = $rid ");
}
function get_list_of_emails($id){
$q = $this->db->query("SELECT * FROM `requisition_emails` WHERE `req_id` = $id")->result_array();
return $q;
}
我在想什麼/做錯了什麼?
N.b.我在localhost上運行這個應用程序。
雖然這是CI相同的問題郵件()應用和解決方案被覆蓋在那裏。 –