Hello!
I'm trying to send mails using SMTP connecting to Office 365 account. Unfortunately it stops... Here are things I could see.
Code:
Severity: Warning --> stream_socket_enable_crypto(): SSL: crypto enabling timeout /home/ekspert/domains/szkola-ekspert.pl/danestrony/system/libraries/Email.php 2006
ERROR - 2016-06-23 17:01:30 -->
220 AM2PR09CA0019.outlook.office365.com Microsoft ESMTP MAIL Service ready at Thu, 23 Jun 2016 15:08:16 +0000
<br /><pre>hello: </pre>The following SMTP error was encountered: <br /><pre>starttls: </pre>The following SMTP error was encountered: <br />The following SMTP error was encountered: <br />Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.<br /><pre>User-Agent: CodeIgniter
Date: Thu, 23 Jun 2016 17:01:15 +0200
From: <*****************************>
Return-Path: <*****************************>
To: *****************************
Subject: =?UTF-8?Q?Wy=C5=9Bwietlono=20stron=C4=99?==?UTF-8?Q?!?=
Reply-To: <*****************************>
X-Sender: *****************************
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <576bf9bbbe287@*****************************>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html><html><head><title>Ktoś wyświetlił stronę!</title></head><body><p>Ktoś wyświetlił stronę eszkola w języku pl.</p></body></html></pre>
The error is:
Code:
A PHP Error was encountered
Severity: Warning
Message: stream_socket_enable_crypto(): SSL: crypto enabling timeout
Filename: libraries/Email.php
Line Number: 2006
Backtrace:
File: /home/********************/domains/****************/danestrony/application/models/Pages_model.php
Line: 50
Function: send
File: /home/********************/domains/****************/danestrony/application/controllers/Pages.php
Line: 11
Function: getPage
File: /home/********************/domains/****************/public_html/index.php
Line: 338
Function: require_once
And my code:
PHP Code:
$this->load->library('email');
$this->email->from('*****************************');
$this->email->to('*****************************');
$this->email->subject('Wyświetlono stronę!');
$this->email->message('<!DOCTYPE html><html><head><title>Ktoś wyświetlił stronę!</title></head><body><p>Ktoś wyświetlił stronę ' . $link . ' w języku ' . $lang . '.</p></body></html>');
$this->email->send();
if(!$this->email->send()) {
log_message('error', PHP_EOL.PHP_EOL.$this->email->print_debugger().PHP_EOL.PHP_EOL);
}
Config file (
application/config/email.php):
Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$config['crlf'] = '\r\n';
$config['newline'] = '\r\n';
$config['wordwrap'] = FALSE;
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.office365.com';
$config['smtp_port'] = 587;
$config['smtp_user'] = '*****************************';
$config['smtp_pass'] = '*****************************';
$config['smtp_crypto'] = 'tls';
$config['smtp_timeout'] = 5;