1

我正在尝试使用 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 电子邮件与 outlook.com 一起使用?

4

0 回答 0