codeigniter form_validation email

// Step 1: Load the form validation library in your controller
$this->load->library('form_validation');

// Step 2: Set validation rules for the email field
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');

// Step 3: Run the form validation
if ($this->form_validation->run() == FALSE) {
    // Step 4a: Validation failed, reload the form with validation errors
    $this->load->view('your_form_view');
} else {
    // Step 4b: Validation passed, process the form data
    $email = $this->input->post('email');
    // Perform further actions with the validated email
}