Codeigniter email sending with gmail smtp with codeigniter email library


class email1 extends MY_Controller {

    function __construct()
    {
        parent::__construct();
    }
    function index()
    {
        //$this->load->view('temp/templatesec');
                    $this->load->library('email');

            $config['protocol']    = 'smtp';

            $config['smtp_host']    = 'ssl://smtp.gmail.com';

            $config['smtp_port']    = '465';

            $config['smtp_timeout'] = '7';

            $config['smtp_user']    = '1515shashitest187@gmail.com';

            $config['smtp_pass']    = 'xxxxxxxxxx';

            $config['charset']    = 'utf-8';

            $config['newline']    = "\r\n";

            $config['mailtype'] = 'text'; // or html

            $config['validation'] = TRUE; // bool whether to validate email or not     

            $this->email->initialize($config);


            $this->email->from('1515shashitest187@gmail.com', 'shashi test');
            $this->email->to('1515shashitest187@gmail.com');


            $this->email->subject('Email Test');

            $this->email->message('Testing the email class.'); 

            $this->email->send();

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

    }
}
?>

Comments

Popular posts from this blog

Script For Login, Logout and View Using PHP, MySQL and Bootstrap

PHP Ajax Login Validation Tutorial

Insert CheckBox and Radio button Data in MySQL Database Using PHP