Welcome Guest, Not a member yet? Register   Sign In
Office365 SMTP SSL operation failed with code 1
#1

Hi!

I'm using CI3 and its Email library to send email over Office365 SMTP server. This is my code:

PHP 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']="\r\n";
$config['crlf'] = "\r\n";

$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:

Code:
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, but I'm certain one of you can help me.

Thank you!
Reply
#2

I don't know what the problem is, but it sounds like you have an infinite loop somewhere, resending a failed message.

Is there anything strange about the message it is failing on, like a massive subject line or body or similar?

I think the email library in CI just tries to send the email once, so I am guessing it is a server issue, or the code you have surrounding your email send.

Hope that helps in some small way,

Paul.
Reply
#3

Sorry to double post, but I found this on Git Hub (am only just discovering the wonders of that service so if I have misunderstood this or got it wrong please forgive my error)

Quote:https://github.com/bcit-ci/CodeIgniter/c...aa02c9e031
Fixed a bug where the :doc:`Database Class <database/index>` entered an endless loop if it fails to connect with the 'sqlsrv' driver.

And in the change log

Quote:Fixed a bug (#3922) - Email and XML-RPC libraries could enter an infinite loop due to PHP bug #39598.


Now I think that fix went into 3.01 so perhaps you could upgrade to latest version if you have not already done so.

That might help,

Paul.
Reply
#4

Thank you, PaulD! I indeed am using verion 3.0.0. and will upgrade today. Then I'll have to wait and see if the problem is gone.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB