CodeIgniter使用outlook.com发送电子邮件

时间:2013-07-26 14:15:32

标签: codeigniter email ssl outlook.com

我正在尝试使用CodeIgniter和 outlook.com 发送电子邮件(使用XAMPP)。

使用Codeigniter和 Gmail 发送电子邮件效果很好,使用以下$config规范:

$config = array(
  'mailtype' => 'html'
  'protocol' => 'smtp',
  'smtp_host' => 'ssl://smtp.googlemail.com',
  'smtp_port' => 465,
  'smtp_user' => '******@gmail.com',
  'smtp_pass' => '******'
);

但是,应用以下 outlook.com 配置规范会导致出现错误消息(请参阅下文):

$config = array(
  'mailtype' => 'html'
  'protocol' => 'smtp',
  'smtp_host' => 'ssl://smtp.live.com',
  'smtp_port' => 587,
  'smtp_user' => '******@outlook.com',
  'smtp_pass' => '******'
);

错误:

A PHP Error was encountered
Severity: Warning
Message: fsockopen(): SSL operation failed with code 1. OpenSSL Error messages:     error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
Filename: libraries/Email.php
Line Number: 1689

A PHP Error was encountered
Severity: Warning
Message: fsockopen(): Failed to enable crypto
Filename: libraries/Email.php
Line Number: 1689

A PHP Error was encountered
Severity: Warning
Message: fsockopen(): unable to connect to ssl://smtp.live.com:587 (Unknown error)
Filename: libraries/Email.php
Line Number: 1689

A PHP Error was encountered
Severity: Warning
Message: fwrite() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1846

A PHP Error was encountered
Severity: Warning
Message: fgets() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1869

A PHP Error was encountered
Severity: Warning
Message: fwrite() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1846

A PHP Error was encountered
Severity: Warning
Message: fgets() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1869

A PHP Error was encountered
Severity: Warning
Message: fwrite() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1846

A PHP Error was encountered
Severity: Warning
Message: fgets() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1869

A PHP Error was encountered
Severity: Warning
Message: fwrite() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1846

A PHP Error was encountered
Severity: Warning
Message: fgets() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1869

A PHP Error was encountered
Severity: Warning
Message: fwrite() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1846

A PHP Error was encountered
Severity: Warning
Message: fgets() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1869

A PHP Error was encountered
Severity: Warning
Message: fwrite() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1846

A PHP Error was encountered
Severity: Warning
Message: fwrite() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1846

A PHP Error was encountered
Severity: Warning
Message: fgets() expects parameter 1 to be resource, boolean given
Filename: libraries/Email.php
Line Number: 1869

Replacing 'smtp_host' => 'ssl://smtp.live.com' with 'tls://smtp.live.com' results in the following error messages:

A PHP Error was encountered
Severity: Warning
Message: fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
Filename: libraries/Email.php
Line Number: 1689

[etc.]

问题: 我需要应用哪些规范才能使Codeigniter Email与outlook.com一起使用?

0 个答案:

没有答案