Akash lal
Akash lal

Reputation: 314

Not able to send email - Codeigniter

I am unable to send email via following configuration.

$config = array();
$config['protocol'] = 'smtp';
$config['mailtype'] = 'text';
$config['charset']='utf-8';
$config['crlf']="\r\n";
$config['newline']="\r\n";
$config['priority']=3;
$config['smtp_host'] = 'smtp.office365.com';
$config['smtp_port']=587;
$config['smtp_crypto']="tls";
$config['smtp_user'] = '************';  
$config['smtp_pass'] = '************'; 
$config['smtp_timeout'] = 120;
$this->email->initialize($config);    
$this->email->set_newline("\r\n");

I have checked millions of blog and articles. Same configuration is working properly on production but not on staging environment.

Following error is generated:

Message: stream_socket_enable_crypto(): SSL: Handshake timed out

Upvotes: 1

Views: 2380

Answers (2)

noushid p
noushid p

Reputation: 1483

$config['smtp_host'] = 'smtp.office365.com';

change to

$config['smtp_host'] = 'ssl://office365.com';

Upvotes: 1

Virb
Virb

Reputation: 1578

Have you check to enable Open SSL module in php.ini?

If not then check the points below.

  • Open your php.ini file
  • Search this line: ;extension=php_openssl.dll
  • Enable the module by removing ; char.
  • Save the file and restart Apache.

Then do check. This may help you.

Upvotes: 1

Related Questions