CodeIgniter Forums
[solved]Can't send email in CI 2.0 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: [solved]Can't send email in CI 2.0 (/showthread.php?tid=39658)



[solved]Can't send email in CI 2.0 - El Forum - 03-16-2011

[eluser]Unknown[/eluser]
this is the code:

Code:
<?php

class Email extends CI_Controller{
    function Email()
    {
        parent::__construct();
    }

    function index(){
        $config = Array(
           'protocol' => 'smtp',
            'smtp_host' => 'ssl://smtp.googlemail.com',
            'smtp_port' => 465,
            'smtp_user' => '***@***.com',
            'smtp_pass' => '*****',
            'mailtype'  => 'html',
            'charset'   => 'iso-8859-1'
        );

        $this->load->library('email', $config);
        $this->email->set_newline("\r\n");

        $this->email->from('***@***.com', '*****');
        $this->email->to('***@***.com');
        $this->email->subject('subject');
        $this->email->message('message');

      
        if($this->email->send())
        {
            echo 'your email was sent, fool';
        }
        else {
        show_error($this->email->print_debugger());
        }
   }

}

and give this error:

Code:
A PHP Error was encountered

Severity: Warning

Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)

Filename: libraries/Email.php

Line Number: 1673
A PHP Error was encountered

Severity: Warning


Please help me.. :-S


[solved]Can't send email in CI 2.0 - El Forum - 03-16-2011

[eluser]Unknown[/eluser]
solved,

1. open your php.ini configuration on wamp
2. uncoment extension=php_openssl.dll
3. restart your wamp

and it's working great.. thank you.