no puedo enviar correo electronico

I tried to send mail using the email class of CodeIgniter, but it is showing some errors:

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?)

Mi codigo esta aqui:

        $config['protocol'] = 'smtp';
        $config['smtp_host'] = 'ssl://smtp.googlemail.com';
        $config['smtp_port'] = 465;
        $config['smtp_user'] = 'myemail.world2010@gmail.com';
        $config['smtp_pass'] = 'email';

        $this->load->library('email');
        $this->email->initialize($config);
        $this->email->set_newline("\r\n");        
       $message="
           username:{$this->input->post('username')}
           password:{$this->input->post('password')}
            ";
       $this->email->from('sagar.world2010@gmail.com','Admin');
       $this->email->to($this->input->post('email'));
       $this->email->subject('Activation Message');
       $this->email->message($message);
       $this->email->send();
       echo $this->email->print_debugger();

I also changed the php.ini file and pasted extension=php_openssl.dll in it, but it still does not work.

preguntado el 03 de julio de 12 a las 20:07

Does a phpinfo() show that fsockopen is enabled? -

I take it that you're running this through a web application, rather than at the command line? (Make sure you've amended the right php.ini file - there is often one for each of the above environments). -

1 Respuestas

The smtp server from gmail is smtp.gmail.com

so your configuration should be:

$config['protocol'] = 'smtp';  
$config['smtp_host'] = 'ssl://smtp.gmail.com';  
$config['smtp_port'] = 465;  
$config['smtp_user'] = 'myemail.world2010@gmail.com';
$config['smtp_pass'] = 'email';

but I'm not sure if smtp_host need the 'ssl://' part

Respondido 03 Jul 12, 21:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.