CodeIgniter Forums
Office 365 SMTP Email config - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Office 365 SMTP Email config (/showthread.php?tid=65043)



Office 365 SMTP Email config - baazil1 - 04-22-2016

CodeIgniter 2.0 (not an option to move up to 3.0 yet), LAMP Server running on Windows Machine (Apache 2.2).

Just migrated to Office 365.

Everything running smoothly except a form that emails out.... I'm receiving the following error message:


Code:
220 BY2PR16CA0040.outlook.office365.com Microsoft ESMTP MAIL Service ready at Fri, 22 Apr 2016 17:53:52 +0000

hello: 250-BY2PR16CA0040.outlook.office365.com Hello [265.136.157.12]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250 CHUNKING

Failed to send AUTH LOGIN command. Error: 504 5.7.4 Unrecognized authentication type
from: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM
The following SMTP error was encountered: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM

to:
The following SMTP error was encountered:

data:
The following SMTP error was encountered:

The following SMTP error was encountered:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

User-Agent: CodeIgniter
Date: Fri, 22 Apr 2016 19:53:53 +0200
From: 
Return-Path: 
To: [email protected]
Subject: =?utf-8?Q?Testing?=
Reply-To: "[email protected]
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0

Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Testing


Configuration of email config file


Code:
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.office365.com';
$config['smtp_user'] = '*******';
$config['smtp_pass'] = '*******';
$config['smtp_port'] = '587';
$config['smtp_crypto'] = 'tls';
$config['smtp_timeout'] = '5';
$config['charset']='utf-8'; // Default should be utf-8 (this should be a text field)
$config['newline']="\r\n"; //"\r\n" or "\n" or "\r". DEFAULT should be "\r\n"


Any ideas why this error pops up?


RE: Office 365 SMTP Email config - Paradinight - 04-22-2016

Try: Add $config['crlf'] = "\r\n";


RE: Office 365 SMTP Email config - baazil1 - 04-22-2016

(04-22-2016, 11:45 AM)Paradinight Wrote: Try: Add $config['crlf'] = "\r\n";

No change... same error.


RE: Office 365 SMTP Email config - tlloyduk - 08-26-2016

I'm having the same problem and wondered if anyone had found a fix ?

It seems to be that AUTH is not advertised in the EHLO from O365


RE: Office 365 SMTP Email config - InsiteFX - 08-27-2016

Sounds like it is not seeing the mail servers ip, check your mail server log files.


RE: Office 365 SMTP Email config - fabiobh - 09-05-2017

Change the line

$config['smtp_timeout'] = '5';

to

$config['smtp_timeout'] = '60';

This error happens because 5 seconds is not sufficent time to authenticate your login and password. If 5 seconds has passed and it not validate your login and password, you will receive this error.


RE: Office 365 SMTP Email config - superiordev - 03-27-2018

I am having a similar issue sending through office365 as well. About 75% of the emails are going out successfully. On the ones not sending, the debugger is showing me errors like:

Failed to send AUTH LOGIN command. Error: 235 2.7.0 Authentication successful target host CY4PR04MB0870.namprd04.prod.outlook.com

and

Failed to authenticate password. Error: Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

By changing the smtp_timeout = 1, I was able to replicate the error, so I'm hopeful that increasing it to something greater than 5 will do the trick.

Thank you for the post and responses!