# My codeigniter site is not sending verification email

**URL:** <https://forum.infinityfree.com/t/my-codeigniter-site-is-not-sending-verification-email/66645>\
**Category:** Hosting Support\
**Created:** [September 29, 2022, 7:23am UTC](https://forum.infinityfree.com/t/my-codeigniter-site-is-not-sending-verification-email/66645 "2022-09-29T07:23:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nasir\_khan](https://forum.infinityfree.com/letter_avatar/nasir_khan/32/5_5575768a8748004e209b776fc1b2916d.png) [@nasir\_khan](https://forum.infinityfree.com/u/nasir_khan)\
**Post date:** [September 29, 2022, 7:23am UTC](https://forum.infinityfree.com/t/my-codeigniter-site-is-not-sending-verification-email/66645/1 "2022-09-29T07:23:49Z")

</div>

### Username ([e.g. epiz\_XXX](https://unlockme.epizy.com/index.php/login.html)) 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);

}

```

---

<div class="post-metadata">

**Author:** ![KangJL](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/kangjl/32/12130_2.png) [@KangJL](https://forum.infinityfree.com/u/KangJL)\
**Post date:** [September 29, 2022, 7:34am UTC](https://forum.infinityfree.com/t/my-codeigniter-site-is-not-sending-verification-email/66645/2 "2022-09-29T07:34:23Z")

</div>

Did you read this?

> [@Sending email from your website (PHP mail)](https://forum.infinityfree.com/t/sending-email-from-your-website-php-mail/49242):
>
> The most common way to send email from your website is by using the PHP mail() function. PHP mail() is an easy to use email system built into the PHP programming language. It’s the default setting for almost all applications. However, PHP mail is severely restricted on InfinityFree. To prevent spam and other abuse, most messages sent through PHP mail are rejected by the mail system. In practice, this means you cannot use PHP mail on InfinityFree to send your email. If you want to send email fr…

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [October 6, 2022, 7:35am UTC](https://forum.infinityfree.com/t/my-codeigniter-site-is-not-sending-verification-email/66645/3 "2022-10-06T07:35:05Z")

</div>

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