6

I’m getting a lot of errors. And I've tried several suggestion across different sites, deleted the parent function, removed the array, updated my php ini file, no luck. This is the first of 13 errors I’m getting.

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

Someone please help.

class Email extends CI_Controller
{
function index()
{
        $config['protocol'] = 'smtp';
        $config['smtp_host'] = 'ssl://smtp.googlemail.com';
        $config['smtp_port'] = 465;
        $config['smtp_user'] = 'myemail@gmail.com';
        $config['smtp_pass'] = 'mypassword';

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

    $this->email->from('myemail@gmail.com', 'My Name');
    $this->email->to('myemail@gmail.com');
    $this->email->subject('This is an email test');
    $this->email->message('Its working. Great!');

    if($this->email->send())
    {
        echo 'Your email was sent, dude.';
    }

    else
    {
        show_error($this->email->print_debugger());
    }
}

}

Mayowa
  • 143
  • 2
  • 11
  • did you check if your system has openssl library installed to enable scripts to make ssl connections from your machine? – Shivaas Jun 27 '11 at 00:41

2 Answers2

10

Use a phpinfo(); statement in a .php file to check if the openssl extension actually loaded.

In your php.ini enable php_openssl

extension=php_openssl.so

if you are on Windows, then

extension=php_openssl.dll
LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • Thanks for the response. I recall, I've enabled that already. – Mayowa Jun 27 '11 at 20:57
  • 2
    Thanks for the answer. Also, if you're using Wampserver in Windows, you can go to the taskbar, click the wampserver icon, then PHP -> PHP extensions and select php_openssl. – José Tomás Tocino Aug 18 '12 at 10:46
0

Mayowa:

Perhaps I'm a little late and you already has this solved.

After searching a lot in the web I found out that for mail configuration simple quotes and double quotes is not the same.

I use the /application/config/email.php file and after many attempts I found out that this will not work:

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

But this will:

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

Hope it helps.

Kyslik
  • 8,217
  • 5
  • 54
  • 87