How to resolve the error: Message: fsockopen(): unable to connect to ssl:// (Connection refused)

I'm using codeigniter I created one email function to send email to particular email ID

public function email($email){
        $config['protocol'] = 'smtp';
        $config['smtp_host'] = 'ssl://';
        $config['smtp_port'] = '465';
        $config['smtp_user'] = '';
        $config['smtp_pass'] = '********************';
        $config['mailtype'] = 'html';
        $config['charset'] = 'utf-8';
        $config['newline'] = "\r\n";
        $config['wordwrap'] = TRUE;

        $this->email->from('', 'MyEmailID');
        $this->email->subject('My Subject');
        $this->email->message('My Message');
        return $this->email->send();

That's working nice in my local machine but when I uploaded that code to hosting server (I'm using Godaddy hosting) I'm getting following error:

A PHP Error was encountered

Severity: Warning

Message: fsockopen(): unable to connect to ssl:// (Connection refused)

Filename: libraries/Email.php

Line Number: 2020


File: /home/MyDir/public_html/application/models/BasicModel.php Line: 47 Function: send

File: /home/MyDir/public_html/application/controllers/Login.php Line: 48 Function: email

File: /home/MyDir/public_html/index.php Line: 315 Function: require_once


You forgot to add '

change from

 $config['smtp_host'] = 'ssl://';


$config['smtp_host'] = '';


Uncomment php_openssl.dll in php.ini


 ? Why i can't receive delivery or read receipt?
 ? Laravel - Sendgrid smtp error "550 Unauthenticated senders not allowed"
 ? Reading data from fsockopen using fgets/fread hangs
 ? Accessing my outlook inbox via php code
 ? Imap select folder in internationalized languages
 ? retrieving image from database
 ? How to check if a textbox is empty VB.Net
 ? Advanced Search
 ? create a table using distinct values from a column as the column names in a code
 ? How to use marquee progress bar on a form while waiting for Task to complete