2015-04-06 83 views
2

我試圖使用CodeIgniter版本2.1.4爲辦公室365使用SMTP服務器發送電子郵件。我知道登錄是正確的。以下是我的配置+調試器輸出。CodeIgniter 2.1.4版本無法通過smtp發送郵件給辦公室365

的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 
+0

你應該升級到3.0笨最新版本 – user4419336

+0

我不知道CI電子郵件庫支持(TLS | SSL)連接要求。您可能需要一個可以處理這些傳輸類型的庫。 http://getsparks.org/packages/swift-mailer/versions/HEAD/show – Philip

+0

@ mustang83不幸的是,CI 3剛剛問世,需要進行相當數量的代碼更改才能正常工作。我正在尋找CI 2修復程序。 –

回答

1

雖然它在CI docs

沒有提到有一個配置項稱爲smtp_crypto,你可以找到在系統庫中的Email.php類中。 您的情況需要設置爲tls

那麼你的配置變得

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