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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.