與笨

2013-06-26 38 views
0

發送電子郵件,我有這個模型我得到我想要送與笨

class Cliente_Model extends CI_Model{ 

public function getInfo($id){ 

    $this->db->select('*'); 
    $this->db->from('pendientes'); 

    $query = $this->db->get();   

    if($query->num_rows() > 0) 
    { 
     foreach ($query->result_array() as $row) 
     { 
      return $row['email']; 
     } 
    } 
    else 
    { 
     return FALSE; 
    } 
} 
} 

控制器

$this->load->model('cliente_model', 'client'); 


$clientInfo = $this->client->getInfo($id);  

$this->email->from('[email protected]', 'Demo'); 
$this->email->to($clientInfo); 

$this->email->subject('Email Test'); 
$this->email->message('your user is '.$clientInfo.' and your password is '.$clave); 

$this->email->send(); 

的電子郵件,我在這裏需要一些幫助,我能得到電子郵件,它可以發送完美,但在消息中我也需要發送密碼,我不知道如何從模型中獲得它。

在此先感謝!

+0

你想發送電子郵件給一個或多個用戶嗎? – ABorty

回答

0

您應該從模型中返回'$ row ['email]',而不是返回整個'$ row',這將允許您從模型中獲取其他數據,而不僅僅是電子郵件字段。

不知道,但你可能需要在控制器中使用這樣的:

$this->email->message('your user is '.$clientInfo->email.' and your password is '.$clientInfo->passwordField); 

好運。

+0

非常感謝你的幫助!有用! :) – Maru

+0

很高興它幫助!如果它有效,您可以通過接受它來批准答案。 :) @Maru – Sushil