I'm using CI3 and its Email library to send email over Office365 SMTP server. This is my code:
$config['mailtype'] = 'html';
$config['smtp_crypto'] = 'tls';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.office365.com';
$config['smtp_user'] = '[USERNAME]';
$config['smtp_pass'] = '[PASSWORD]';
$config['smtp_port'] = '587';
$config['charset']='utf-8';
$config['newline']="
";
$config['crlf'] = "
";
$this->email->initialize($config);
$this->email->from('[FROM]', '[FROM NAME]');
$this->email->reply_to('[REPLY TO]', '[REPLY TO TEXT]');
$this->email->to($message['email']);
$this->email->subject($message['subject']);
$this->email->message($output);
$this->email->send()
Everything works fine for most of the time. But sometimes this is what I get in the error log:
ERROR - 23.10.2015 09:46:32 --> Severity: Warning --> fwrite(): SSL operation failed with code 1. OpenSSL Error messages:
error:140D00CF:SSL routines:SSL_write:protocol is shutdown /home/[USER]/domains/[DOMAIN]/public_html/system/libraries/Email.php 2131
The main problem is, when this starts happening, it doesn't stop until I reboot the server or the server runs out of disc space!!! And it's happening really fast, a few MB of data per second which means a file size of a few GB in a really short period of time!
I'm not sure, this is actually related to CI or maybe it's a server issue?
Thank you!