【问题标题】:Codeigniter SMTP Email ErrorCodeigniter SMTP 电子邮件错误
【发布时间】:2014-06-07 16:18:35
【问题描述】:

在我的 codeigniter 应用程序中使用 SMTP 时,我无法发送电子邮件。

关于 SO 有很多类似的问题,但没有一个能解决我的问题,所以我再次问。

这是我得到的错误:

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: myemail@gmail.com
Subject: =?utf-8?Q?Request_from_C&J_Builders_Contact_form?=
Reply-To: "donotreply@C&JBuilders.us" 
X-Sender: donotreply@C&JBuilders.us
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <53572b54551be@C&JBuilders.us>
Mime-Version: 1.0


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

From: jeff
Email: jeff@gmail.com
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'] = "donotreply@cjbuilders.info";
$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";

?> 

这是我发送电子邮件的控制器 sn-p:

// sends the email to 
$this->email->from('donotreply@C&JBuilders.us');
$this->email->to('myemail@gmail.com');
$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();

【问题讨论】:

  • 尝试添加配置$config['smtp_crypto'] = 'ssl'; 它不在官方文档中,某些 SMTP 服务器需要 ssl 身份验证。
  • 没有什么不同。这个页面说 zoho 确实需要 ssl zoho.com/mail/faq.html
  • 它在你给我的链接上显示 SSL

标签: php codeigniter email smtp zoho


【解决方案1】:

对于 SSL,将 ssl:// 添加到您的 SMTP 主机地址

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

【讨论】:

  • 工作就像一个魅力。谢谢!
  • @Catfish 很高兴为您提供帮助 :)
  • 谢谢你——正是我所需要的
  • 我用过 tls:// 这也适用于我。顺便说一句,谢谢。
  • @SajjadHossain 是的,这取决于协议您的邮件服务器工作
猜你喜欢
  • 2014-02-15
  • 2014-10-26
  • 2012-10-27
  • 2011-06-12
  • 1970-01-01
  • 2016-06-25
  • 2016-11-15
  • 2012-01-04
  • 2018-12-08
相关资源
最近更新 更多