Reputation: 937
I'm setting a system that when a user creates an account, and email is sent sending a link with a token to verify their account and change the status from pending to active.
in the create user function, when they are sent to the confirmation page after all the other criteria is checked out - I am loading a email verification function in my model that pulls certain info from the db and sends them an email. I am having trouble getting the emails to send and am not sure if the variables are able to be passed in this manner, although I have echoed them and they are existing.
Here is my controller portion:
$this->load->model('user_model');
if($query = $this->user_model->create_member())
{
$this->load->model('User_model');
$this->User_model->varification_email();
$data['main_content'] = 'account/welcome';
$this->load->view('includes/templates/main_page_template', $data);
}
and the model portion:
f
unction varification_email()
{
$query = $this->db->query('SELECT * FROM users order by id desc LIMIT 1');
foreach ($query->result() as $user)
{
$this->load->library('email');
$this->email->from('[email protected]', 'noreply');
$this->email->to($user->email);
$this->email->subject('test');
$this->email->message('test');
$this->email->send();
}
}
thanks in advance.
Upvotes: 0
Views: 439