gpt4 book ai didi

php - 无法在 codeigniter 3 中使用 SMTP gmail 配置发送电子邮件

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:07:51 25 4
gpt4 key购买 nike

下面是我的代码,我引用了堆栈溢出和 codeigniter 用户指南中的所有示例。我仍然无法解决这个问题

public function send()
{
$config['protocol'] = 'smtp';
$config['smtp_crypto'] = 'ssl';
$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = '**********@gmail.com';
$config['smtp_pass'] = '********';
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['wordwrap'] = TRUE;
$config['smtp_timeout'] = 30;
$this->email->initialize($config);
$this->email->from('uvizag@gmail.com', 'admin');
$this->email->to('siddharthaesunuri@gmail.com, siddhu.php@gmail.com');
$this->email->subject('Registration Verification:');
$message = "Thanks for signing up! Your account has been created...!";
$this->email->message($message);
if ( ! $this->email->send()) {
show_error($this->email->print_debugger());
}

}

enter image description here

enter image description here

如何解决这个错误?能不能帮我个忙

最佳答案

你试试这个吗?

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

// Set to, from, message, etc.

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

并确保您已经设置了您的电子邮件帐户 Allowing less secure apps to access your account

关于php - 无法在 codeigniter 3 中使用 SMTP gmail 配置发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38417920/

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