2014-04-23 137 views
6

當我的codeigniter應用程序使用SMTP時,無法發送我的電子郵件。Codeigniter SMTP電子郵件錯誤

有很多類似的問題,但沒有解決我的問題,所以我再次問。

這裏是我得到的錯誤:

hello: 

The following SMTP error was encountered: 
Failed to send AUTH LOGIN command. Error: 

from: 

The following SMTP error was encountered: 

to: 

The following SMTP error was encountered: 

data: 

The following SMTP error was encountered: 

The following SMTP error was encountered: 
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method. 

User-Agent: CodeIgniter 
Date: Tue, 22 Apr 2014 22:54:12 -0400 
From: 
Return-Path: 
To: [email protected] 
Subject: =?utf-8?Q?Request_from_C&J_Builders_Contact_form?= 
Reply-To: "[email protected]&JBuilders.us" 
X-Sender: [email protected]&JBuilders.us 
X-Mailer: CodeIgniter 
X-Priority: 3 (Normal) 
Message-ID: <[email protected]&JBuilders.us> 
Mime-Version: 1.0 


Content-Type: text/plain; charset=utf-8 
Content-Transfer-Encoding: 8bit 

From: jeff 
Email: [email protected] 
Phone: 555555555 
Message: asdfs fds 

Here's my config/email.php: 
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); 

$config['useragent'] = "CodeIgniter"; 
$config['protocol'] = "smtp"; 
$config['_smtp_auth'] = TRUE; 
$config['smtp_host'] = "smtp.zoho.com"; 
$config['smtp_user'] = "[email protected]"; 
$config['smtp_pass'] = "mypassword"; 
$config['smtp_port'] = 465; 
$config['wordwrap'] = TRUE; 
$config['wrapchars'] = 76; 
$config['mailtype'] = "text"; 
$config['charset'] = "utf-8"; 
$config['validate'] = FALSE; 
$config['priority'] = 3; 
$config['crlf'] = "\r\n"; 
$config['newline'] = "\r\n"; 
$config['bcc_batch_mode'] = TRUE; 
$config['bcc_batch_size'] = "200"; 

?> 

這裏是我的控制器代碼段用於發送電子郵件:

// sends the email to 
$this->email->from('[email protected]&JBuilders.us'); 
$this->email->to('[email protected]'); 
$this->email->subject('Request from C&amp;J Builders Contact form'); 
$this->email->message('From: '.$this->input->post('name')."\n". 
       'Email: '.$this->input->post('email')."\n". 
       'Phone: '.$this->input->post('phone')."\n". 
       'Message: '.$this->input->post('message')."\n"); 
$this->email->send(); 
echo $this->email->print_debugger(); 
+0

嘗試添加配置'$ config ['smtp_crypto'] ='ssl';'它不在官方文檔中,某些SMTP服務器需要ss l身份驗證。 – tomexsans

+0

不做任何不同的事情。這個頁面說,zoho DOES需要SSL https://www.zoho.com/mail/faq.html – Catfish

+0

它說你在給我的鏈接上的SSL – tomexsans

回答

7

對於SSL加ssl://到您的SMTP主機地址

$config['smtp_host'] = "ssl://smtp.zoho.com"; 
+0

工作就像一個魅力。謝謝! – Catfish

+0

@Catfish很樂意幫助你:) –

+0

感謝你 - 正是我需要的 – Laurence