我正在尝试使用CodeIgniter版本2.1.4使用Office 365的SMTP服务器发送电子邮件。我知道登录正确。以下是我的配置+调试器输出。
application / config / email.php
<?php
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'tls://smtp.office365.com';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'PASSWORD';
$config['smtp_port'] = '587';
$config['charset']='utf-8';
$config['newline']="\r\n";
$config['crlf'] = "\r\n";
?>
电子邮件调试器错误:
The following SMTP error was encountered: 0
Unable to send data: AUTH LOGIN
Failed to send AUTH LOGIN command. Error:
Unable to send data: MAIL FROM:
from:
The following SMTP error was encountered:
Unable to send data: RCPT TO:
to:
The following SMTP error was encountered:
Unable to send data: DATA
data:
The following SMTP error was encountered:
Unable to send data: User-Agent: CodeIgniter Date: Mon, 6 Apr 2015 12:19:52 -0400 From: "PHP Point Of Sale, LLC" Return-Path: To: [email protected] Subject: =?utf-8?Q?Sales_Receipt?= 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: multipart/alternative; boundary="B_ALT_5522b228bf4b9" This is a multi-part message in MIME format. Your email application may not support this format. --B_ALT_5522b228bf4b9 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit PHP Point Of Sale, LLC 123 Nowhere street 555-555-5555 Sales Receipt 04/06/2015 12:19 pm Customer: Chris Muench - Apple - 3333 Address : 6 Heron Way N Fairport NY, 14450-3318United States Phone Number : testE-Mail : [email protected] ID: POS 9 Register Name: Default Employee: John Doe Item Price Qty. Total TEST (Size) $12.00 1 $12.00 Sub Total $12.00 Total $12.00 Payment Type Cash $12.00 Change Due $0.00 Change return policy --B_ALT_5522b228bf4b9 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
尽管CI文档中未提及
smtp_crypto
您可以Email.php
在系统库的类中找到一个名为的配置项。您的情况需要设置为tls
。
所以你的配置变成
$config['smtp_crypto']= 'tls';
$config['smtp_host'] = 'smtp.office365.com';
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句