未能在笨发送AUTH LOGIN命令(Failed to send AUTH LOGIN comma

2019-09-18 21:11发布

即时得到一堆错误每次我尝试发送电子邮件:

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"

Answer 1:

尝试这个

 $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();


Answer 2:

这里的银弹是

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



Answer 3:

有STRATO托管服务器上类似的问题,我的解决办法是改变,

$config['protocol'] = "smtp";
to:
$config['protocol'] = "sendmail";


文章来源: Failed to send AUTH LOGIN command in codeigniter