sending email in codeigniter

hey anyone can help me to get out of this problem, I am getting following error A PHP Error was encountered

Severity: Warning

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

Filename: libraries/Email.php

Line Number: 1689

A PHP Error was encountered

Severity: Warning

Message: fwrite() expects parameter 1 to be resource, boolean given

Filename: libraries/Email.php

Line Number: 1846

And I have the following code in my emailer class

Class MailSender extends CI_Model{

    function __construct(){
        parent::__construct();
    }

    public function sendMail(){
        $config=array(
                'protocol'=>'smtp',
                'smtp_host'=> 'ssl://smtp.googlemail.com',
                'smtp_port' => 587,
                'smtp_user' => 'bhatta.bj@gmail.com',
                'smtp_pass' => 'signature08'
        );

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

        $this->email->from("bhatta.bj@gmail.com");
        $this->email->to("curtains_v@hotmail.com");
        $this->email->subject("this is a sample mail");
        $this->email->message("this is a sample message please check this");

        if($this->email->send()){
            //$data['message']="Email sent successfully";
            return true;

        }else{
            //$data['message']="Couldnt sent the email, please provide me valid email address";
            return false;
        }

    }
}

Answers


The code works fine, please ensure you have the openssl extension loaded.

http://www.devcha.com/2010/01/php-fsockopen-unable-to-connect-ssl.html


Do you have openssl extension actually loaded? Use a phpinfo();in a .php file to see if the openssl extension is loaded or Have you done any modifications to php.ini that caused this?


Need Your Help

Updating a jQuery function on the fly

jquery

I have this code below that filters my array for only items that have type For Sale. classifieldData being the array:

Android trying to create a base class for the Activity classes and app crashes

android

I thought it would be need if I had a base class for all my screens on android. Then I would not have to retype in the same stuff,....but it crashes when I replace Activty with cBase (my base clas...