CodeIgniter Forums

Full Version: SMTP not working in CI 3.0 while same code is working in CI 2.*
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is a big issue i'm struggling with, the thing is our application needs to send email, now we are relying on smtp, until 2.*(latest) email worked fine, but as soon as we ported app in ci 3.0 everything worked by smtp, here is error we are getting on ci 3.0 sample email
Code:
   A PHP Error was encountered

   Severity: Warning

   Message: fwrite(): SSL operation failed with code 1. OpenSSL Error messages: error:140D00CF:SSL routines:SSL_write:protocol is shutdown

   Filename: libraries/Email.php

   Line Number: 2131

   Backtrace: has nothing, it is shown blank, used bold text to specify that
i wonder if anyone is facing this issue, would appreciate help on this one
PHP Code:
function sendEmail($to,$subject,$body,$from "My Company Name")
 
   {
 
       $CI =& get_instance();
 
       $CI->load->library('email');
 
       $config['protocol'    'smtp';
 
       $config['smtp_host'   'ssl://smtp.zoho.com';
 
       $config['smtp_port'   '465';
 
       $config['smtp_timeout'] = '7';
 
       $config['smtp_user'   '[email protected]_domain.com';
 
       $config['smtp_pass'   'secret_password';
 
       $config['charset'     'utf-8';
 
       $config['newline'     "\r\n";
 
       $config['mailtype'    'html'// or html
 
       $config['validation'  TRUE// bool whether to validate email or not
 
       $CI->email->initialize($config);
 
       $CI->email->from('[email protected]_domain.com',$from);
 
       $CI->email->to($to); 
 
       $CI->email->subject($subject);
 
       $CI->email->message($body);
 
       if($CI->email->send())
 
       {
 
           //return true;
 
           echo $CI->email->print_debugger();
 
       }
 
       else
        
{
 
           //return false;
 
           echo $CI->email->print_debugger();
 
       }