Welcome Guest, Not a member yet? Register   Sign In
Problem with send mail in CI 2.0
#1

[eluser]VanTheMan[/eluser]
Hi,

I'm trying to send emails through gmail with SMTP, but I've been trying for hours with no success.

This is the last code I tried:
Code:
<?php
class Email extends CI_Controller{
    function __construct(){
        parent::__construct();
    }
        
    function index(){
        $config = array(
            'protocol' => 'smtp',
            'smtp_host' => 'ssl://smtp.googlemail.com',
            'smtp_port' => 465,
            'smtp_user' => '[email protected]',
            'smtp_pass' => 'pass'
        );
        
        $this->load->library('email',$config);
        
        $this->email->set_newline("\r\n");
        
        $this->email->from('[email protected]','Test');
        $this->email->to('[email protected]');
        $this->email->subject('Test');
        $this->email->message('Test email CI');
        
        if ($this->email->send())
            echo "Successful";
        else
            show_error($this->email->print_debugger());
    }
}
?>

And I have some errors:

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

And more....

Please help me to fix this, in my php.ini, I set it as default
#2

[eluser]eoinmcg[/eluser]
sounds like you haven't enabled openssl in php.

enabling it varies depending on your system. google around and you'll find how to enable it.
#3

[eluser]VanTheMan[/eluser]
Thanks, I have fixed this
#4

[eluser]duy31187[/eluser]
[quote author="VanTheMan" date="1305733404"]Thanks, I have fixed this[/quote]
did you run in localhost or in hosting ? if in hosting can you show me?




Theme © iAndrew 2016 - Forum software by © MyBB