My codeigniter site is not sending verification email

Username (e.g. epiz_XXX) or Website URL

(please specify the website or account you are asking about)

this is my site i hosted but when i want to register it is not sending confirmation email

(please share the FULL error message you see)

Other Information

public function register()

{

    if($this->input->server('REQUEST_METHOD') === 'POST')

    {      

        $this->form_validation->set_rules('FirstName', 'First Name', 'required|min_length[3]');

        $this->form_validation->set_rules('LastName', 'Last Name', 'required|min_length[3]');

        $this->form_validation->set_rules('Email', 'Email', 'required|valid_email|is_unique[gsm_members.Email]');

        $this->form_validation->set_rules('Password', 'Password', 'required|min_length[5]');

        $this->form_validation->set_rules('CPassword', 'Confirm Password', 'required|matches[Password]');

        ## set custom validation error messages ##

        $this->form_validation->set_message('is_unique', "This email is already registered with us.");          

        if ($this->form_validation->run() !== FALSE)

        {

            $data = $this->input->post(NULL, TRUE); //collect form data            

            //register data to database

            $token = rand(123456789, 987654321);

            unset($data['CPassword']);

            $data['Token'] = $token;

            $data['Password'] = md5($data['Password']);

            $data['Status'] = 'Disabled';

            $data["CreatedDateTime"] = date("y-m-d H:i:s");

                           

            $this->member_model->insert($data);

            ## Get Issue Email Template ##

            $template = $this->autoresponder_model->get_where(array('Status' => 'Enabled', 'ID' => 1)); // Registration Email                  

            ## Send Email with Template ##      

            if(isset($template) && count($template)>0)

            {

                $from_name = $template[0]['FromName'];

                $from_email = $template[0]['FromEmail'];

                $to_email = $template[0]['ToEmail'];

                $subject = $template[0]['Subject'];

                $message = html_entity_decode($template[0]['Message']);

               

                //Information

                $post['Password'] = $password;

                $post['FirstName'] = $data['FirstName'];

                $post['LastName'] = $data['LastName'];

                $post['Email'] = $data['Email'];

                $post['Password'] = $this->input->post('Password', TRUE);

                $post['TokenUrl'] = site_url('user/verify/'.$token);

           

                $this->fsd->email_template($post, $from_email, $from_name, $to_email, $subject, $message );

                $this->fsd->sent_email($from_email, $from_name,$to_email, $subject, $message );

            }

            ## Get Issue Email Template ##

            $template = $this->autoresponder_model->get_where(array('Status' => 'Enabled', 'ID' => 8)); // Registration notification to admin

            ## Send Email with Template ##      

            if(isset($template) && count($template)>0)

            {

                $from_name = $template[0]['FromName'];

                $from_email = $template[0]['FromEmail'];

                $to_email = $template[0]['ToEmail'];

                $subject = $template[0]['Subject'];

                $message = html_entity_decode($template[0]['Message']);

               

                //Information

                $post['Password'] = $password;

                $post['FirstName'] = $data['FirstName'];

                $post['LastName'] = $data['LastName'];

                $post['Email'] = $data['Email'];

                $post['Password'] = $this->input->post('Password', TRUE);                  

           

                $this->fsd->email_template($post, $from_email, $from_name, $to_email, $subject, $message );

                $this->fsd->sent_email($from_email, $from_name,$to_email, $subject, $message );

            }

            $this->session->set_flashdata("success","A verification email has been sent to your email.");

            redirect('login');                                  

        }

    }

    $data = array();

    $data["title"] = "Register";

    $data["heading"] = "Register";

    $data['master_template'] = "user/register";

    $this->load->view("user/master_template",$data);

}

Did you read this?

7 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.