SMTP not working in CI 3.0 while same code is working in CI 2.*

匿名 (未验证) 提交于 2019-12-03 09:52:54

问题:

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

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

here is the issue i found on github Error trying to send a mail

i wonder if anyone is facing this issue, would appreciate help on this one

source 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']    = 'no-reply@my_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('no-reply@my_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();         }     } 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!