<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');

class SupportCtrl extends CI_Controller

{



    public function index()

    {
        $this->load->model('Users_m');
        $mob = $this->Users_m->get_user_mobile($this->session->user_id);
        $data['mob'] = $mob->mobile_num;
        $this->load->view('templates/1_head.php');

        $this->load->view('templates/2_nav.php');

        $this->load->view('templates/3_sidebar_menu_left.php');



        $this->load->view('support', $data); //4_dynamic



        $this->load->view('templates/5_footer.php');

        $this->load->view('templates/6_script_end.php');
    }

    public function mail_send()

    {
        $this->load->model('Users_m');
        //$mob = $this->Users_m->get_user_mobile($this->session->user_id);
        //$data['mob'] = $mob->mobile_num;

        // $this->load->library('email');

        $mail = $this->input->post('mail');
        $name = $this->input->post('name');
        $mob = $this->input->post('mobile');
        $msg = $this->input->post('message');

        /* $this->email->from($mail, $name);
        $this->email->to('quickearnltd@gmail.com');
        //$this->email->to('rf@mailsac.com');

        $this->email->subject('Customer Support');
        $this->email->message($msg . '<br><br>' . $name . '<br>' . $mob);
        $this->email->set_mailtype("html");

        $this->email->send(); */

        $config = array(
            'protocol' => 'smtp',
            'smtp_host' => 'ssl://smtp.googlemail.com',
            'smtp_port' => 465,
            'smtp_user' => 'quickworkerltd@gmail.com', // change it to yours
            'smtp_pass' => 'Zzedyc65EkzwtSv', // change it to yours
            'mailtype' => 'html',
            'charset' => 'iso-8859-1',
            'wordwrap' => TRUE
        );

        $message = $msg . '<br><br>' . $name . '<br>' . $mob;
        $this->load->library('email', $config);
        $this->email->set_newline("\r\n");
        $this->email->from($mail); // change it to yours
        $this->email->to('info@biz-bazar.com'); // change it to yours
        $this->email->subject('Customer Support');
        $this->email->message($message);
        if ($this->email->send()) {
            //echo 'Email sent.';
        } else {
            show_error($this->email->print_debugger());
        }

        $this->session->set_flashdata('fls_msg', 'Successfully sent Mail');

        return redirect('supportCtrl/');
    }
}
