Welcome Guest, Not a member yet? Register   Sign In
Help with the email class?
#1

[eluser]Corey Freeman[/eluser]
So I'm just using the defaults but for some reason cannot manage to get emails to send...here's what I have:

Code:
function create_member()
    {
        $this->load->library('form_validation');
        $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
        $this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[4]|alpha_dash|callback_new_username');
        $this->form_validation->set_rules('password', 'Password', 'required|min_length[6]');
        $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required|matches[password]');
        $this->form_validation->set_rules('email_address', 'Email', 'trim|required|valid_email|callback_new_email');
        if($this->form_validation->run() == FALSE)
        {
            $data['title'] = 'Create New User';
            $this->load->view('home', $data);
        }
        else
        {            
            $this->load->model('membership_model');
            //They've completed the registration process! Sweet!
            if($query = $this->membership_model->create_member()) {
                //Email me
                $this->load->library('email');
                $this->email->from('[email protected]', 'Your Name');
                $this->email->to('[email protected]');
                $this->email->subject('Email Test');
                $this->email->message('Testing the email class.');
                $this->email->send();
                //Log them in for the first time!
                $data = array(
                'access_level' => '1',
                'username' => $this->input->post('username'),
                'is_logged_in' => true
                );
                $this->session->set_userdata($data);
                $this->session->set_flashdata('message', '<div id="first-welcome">You have successfully registered and have been automatically logged in!</div>');
                redirect('dashboard');
            }
            else
            {
                $this->session->set_flashdata('message', '<p id="error">There was an error creating your account. Please Try Again</p>');
                redirect('home');            
            }
        }
    }

I feel like I'm missing something really obvious.
#2

[eluser]danmontgomery[/eluser]
http://ellislab.com/codeigniter/user-gui...email.html

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

This is a good place to start...
#3

[eluser]Corey Freeman[/eluser]
It was actually returning that the emails were sent successfully everytime...at any rate it seems to be working again so far.




Theme © iAndrew 2016 - Forum software by © MyBB