gpt4 book ai didi

php - 发送电子邮件 Codeigniter 错误

转载 作者:可可西里 更新时间:2023-11-01 13:24:13 27 4
gpt4 key购买 nike

我正在尝试从我的本地主机发送带有我的 codeigniter 项目的电子邮件,但它总是显示如下错误:

    220 mx.google.com ESMTP pp9sm11498734pbb.65 - gsmtp 

hello: 250-mx.google.com at your service, [202.43.95.33]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
Failed to authenticate password. Error: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 pp9sm11498734pbb.65 - gsmtp
from: 530-5.5.1 Authentication Required. Learn more at
530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 pp9sm11498734pbb.65 - gsmtp
The following SMTP error was encountered: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 pp9sm11498734pbb.65 - gsmtp
to: 530-5.5.1 Authentication Required. Learn more at
530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 pp9sm11498734pbb.65 - gsmtp
The following SMTP error was encountered: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 pp9sm11498734pbb.65 - gsmtp
data: 530-5.5.1 Authentication Required. Learn more at
530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 pp9sm11498734pbb.65 - gsmtp
The following SMTP error was encountered: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 pp9sm11498734pbb.65 - gsmtp
502 5.5.1 Unrecognized command. pp9sm11498734pbb.65 - gsmtp
The following SMTP error was encountered: 502 5.5.1 Unrecognized command. pp9sm11498734pbb.65 - gsmtp
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Mon, 19 Jan 2015 12:49:08 +0100
From: "andhika" <mytest@gmail.com>
Return-Path: <mytest@gmail.com>
To: coba@gmail.com
Subject: =?utf-8?Q?test?=
Reply-To: "mytest@gmail.com" <mytest@gmail.com>
X-Sender: mytest@gmail.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <54bcef349adf6@gmail.com>
Mime-Version: 1.0


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

world

这是我的 Controller :

$this->load->library('email');
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_user' => 'mytest@gmail.com',
'smtp_pass' => 'youpassword',
'smtp_port' => '465'
);
$this->email->initialize($config);
$this->email->set_newline('\r\n');

$this->email->from('mytest@gmail.com', 'andhika');
$this->email->to('coba@gmail.com');
$this->email->subject('test');
$this->email->message('world');


if ($this->email->send()){
echo 'Your e-mail has been sent';
}
else{
show_error($this->email->print_debugger());
}

这是在我的 php.ini 设置中:extension=php_openssl.dll

有答案吗?

非常感谢...

最佳答案

$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'username',
'smtp_pass' => 'password',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");

$result = $this->email->send();

Forum

stackoverflow

你可以看看这个Mailgun .它看起来非常易于使用和安全。

关于php - 发送电子邮件 Codeigniter 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28024117/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com