Jump to content

sending email with codeigniter


RalphLeMouf

Recommended Posts

hey there - I am setting up a system that when a new account is created, the new user is sent an email with a confirmation email that has hashed token link to it for security. I'm getting confirmation that emails are being sent via

$this->email->print_debugger();

however, I've only been able to receive one email. I'm wondering if all of my configurations for my server ( as I'm developing locally) are set up properly, as well as my code flow being correct.

CONTROLLER:

 

                     

$this->load->model('user_model');
		if($query = $this->user_model->create_member())
		{
			$this->load->model('user_model');
			$this->varification_email();
			$data['main_content'] = 'account/welcome';
			$this->load->view('includes/templates/main_page_template', $data);

		}
		else
		{
			$this->load->view('home/home_page');
		}
	}
}

function 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('noreply@blah.com', 'blahblahblah');
			$this->email->to($user->email);
			echo $user->email; 

			$this->email->subject('Email Test');
			$this->email->message('Testing the email class.');	

			$this->email->send();

			echo $this->email->print_debugger();

	}
}

 

MODEL:

 

Also, I'm assuming it's okay to do this ONLY on my controller with no involvement with a model?

 

 

Thanks in advance.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.