首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >无法在codeigniter中发送AUTH登录命令

无法在codeigniter中发送AUTH登录命令
EN

Stack Overflow用户
提问于 2012-07-01 13:36:50
回答 3查看 15.3K关注 0票数 7

每次我尝试发送电子邮件时,都会收到一堆错误:

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: Sun, 1 Jul 2012 20:47:47 +0000
From: "Rapphie" 
Return-Path: 
To: csorila17@gmail.com
Subject: =?iso-8859-1?Q?Email_Test?=
Reply-To: "alinorapjoseph@gmail.com" 
X-Sender: alinorapjoseph@gmail.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <4ff0b7736810b@gmail.com>
Mime-Version: 1.0

//..

我看不出有什么不对劲的地方,但说真的,也许我漏掉了一些重要的东西..以下是我的控制器中的内容。

$config = Array(
    'protocol' => 'smtp',
    'smtp_host' => 'smtp.googlemail.com',
    'smtp_port' => 465,
    'smtp_user' => 'alinorapjoseph@gmail.com',
    'smtp_pass' => '****',
    'mailtype'  => 'html', 
    'charset'   => 'iso-8859-1'
);
$this->load->library('email', $config);

            $this->email->from('alinorapjoseph@gmail.com','Rapphie');
            $this->email->to($email,'Charmie');
            $this->email->subject('Email Test');
            $this->email->message('Testing the email class.');

            $this->email->send();

            echo $this->email->print_debugger();

我不使用"ssl://smtp.gmail.com“,因为它会给我另一个错误,比如:

fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl"
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2014-09-15 13:08:54

尝尝这个

 $from = 'noreply@example.com';
 $to   = 'bob@example.com';
 $subject = 'your subject';
 $message = 'your message';

 $this->load->library('email');

 $config['mailtype'] = 'html';
 $config['smtp_port']='465';
 $config['smtp_timeout']='30';
 $config['charset']='utf-8';
 $config['protocol'] = 'smtp';
 $config['mailpath'] = '/usr/sbin/sendmail';
 $config['charset'] = 'iso-8859-1';
 $config['wordwrap'] = TRUE;

 $this->email->initialize($config);
 $this->email->from($from);
 $this->email->to($to);
 $this->email->subject($subject);
 $this->email->message($message);

 // Sending Email
 $this->email->send();
票数 3
EN

Stack Overflow用户

发布于 2016-07-29 12:37:42

这里的银弹是

$config['newline'] = "\r\n";

票数 1
EN

Stack Overflow用户

发布于 2018-05-28 08:59:04

在strato托管服务器上有类似的问题,我的解决方案正在改变,

$config['protocol'] = "smtp";
to:
$config['protocol'] = "sendmail";
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11279831

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档