У меня есть одна форму выбора в моем приложении .. в том, что я получаю список пользователей из таблицы пользователей в поле выбора. Я пытаюсь отправить почту в зависимости от выбранный пользователь из раскрывающегося списка .. Я получил user_id из раскрывающегося списка .. но я не получил электронную почту. Я много пробовал, но я не нашел, где я получил ошибку.отправить почту из зависимости от выбранного пользователя в codeigniter
Вот мой контроллер :
общественная функция add_selection() {
$data["msg"]="";
$this->load->model('SelectionModel');
$data['rolename']=$this->SelectionModel->getrolename();
$data['candidate']=$this->SelectionModel->getcandidates();
$data['usertype']=$this->SelectionModel->getusers();
если ($ this-> вход-> пост())
{
$this->SelectionModel->add_selection_details($this->input->post());
$all_users = $this->input->post('user_id');
print_r($all_users);
foreach($all_users as $key)
{
$get_email = $this->SelectionModel->get_user_email_by_id($key);
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://md-in-42.webhostbox.net',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'test3'
);
$this->load->library('email',$config);
$this->email->set_mailtype("html");
$this->email->from('[email protected]', 'bharathi');
$this->email->to($get_email);
$this->email->subject('this is our candidate details pls go through it');
$link = 'Click on this link - <a href="http://localhost/job_portal/index.php/Login/signin">Click Here</a>';
$this->email->message($link);
print_r($get_email);
if($this->email->send())
{
echo "email sent";
}
else
{
echo "email failed";
}
}
}
$this->load->view('selection/selection_details',$data);
}
Это моя модель:
function get_user_email_by_id($user_id)
{
$this->db->select('*');
$this->db->from('users');
$this->db->where('user_id',$user_id);
$query = $this->db->get();
$result = $query->row_array();
return $result['email'];
}
, пожалуйста, помогите мне, как это сделать .. Спасибо ..
Что выводится на 'print_r ($ all_users); '? –
it display user_id – M5533
Я пытаюсь получить этот адрес user_id .. но он не работает. – M5533