Welcome Guest, Not a member yet? Register   Sign In
Sending email over Office365 SMTP account with Email library
#1

Hi!

I know this issue is probably related to server settings (Debian based), but I'll give it a try.

First of all, everything works fine on my local WAMP server but I can't send emails using my Office account on my production server. I've managed to open the port 587 in firewall configuration but still no success.

Here is the code I'm using:

PHP Code:
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.office365.com';
$config['smtp_user'] = '****';
$config['smtp_pass'] = '****';
$config['smtp_port'] = 587;
$config['smtp_timeout'] = 60;
$config['smtp_crypto'] = 'tls';
$config['mailtype'] = 'html';

$this->email->initialize($config);

$this->email->from('****''****');
$this->email->to('****');

$this->email->subject('Email Test');
$this->email->message('Testing the email class.');

$this->email->send(FALSE);

$this->email->print_debugger(); 

But after a while I get this error:

Code:
Message: stream_socket_enable_crypto(): SSL: crypto enabling timeout

OpenSSL is enabled (according to phpinfo()).

I tried sending an email over the same Office account with Phpmailer library and everything worked as expected!

Does anyone have a solution?


Thank you!
Reply
#2

Anyone? Any help would be really appreciated. Thank you!
Reply
#3

Make sure you set your SMTP in your php.ini file to your office one etc;
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

I did found some settings in php.ini for smtp host and port, but it says they are for Windows only. I'm running Debian.

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
Reply
#5

Then you will need to find out how they are setting them.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

(06-30-2015, 09:20 PM)you\d need to use following line to override CodeIgniter's configuration parameter Wrote: ‘newline’ => “\r\n”, //must have for office365!
I published an article here:


http://aus800.com.au/sending-out-emails-...5-account/.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB