gpt4 book ai didi

PHP (Codeigniter) 电子邮件帮助

转载 作者:可可西里 更新时间:2023-11-01 00:26:34 25 4
gpt4 key购买 nike

我正在尝试使用 Codeigniters 电子邮件类将模板加载到电子邮件中,但是我收到的电子邮件是黑色的,谁能告诉我为什么?下面是我的代码,

if($this->session->userdata('group_id') == '1') {
$data['key'] = $insertUser['activation_key'];
$data['name'] = $insertUser['name'];
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '*********',
'smtp_pass' => '********',
'mailtype' =>'html'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");

$this->email->from('no-reply@email.com', 'Email');
$this->email->to($insertUser['email']);

$this->email->subject('Your employers account');
$this->email->message($this->load->view('emails/signup', $data));


if (!$this->email->send())
show_error($this->email->print_debugger());
else
redirect('admin/users');
}

最佳答案

您需要将第三个参数添加到对 $this->load->view 的调用中,以便将 View 作为字符串返回:

$this->email->message($this->load->view('emails/signup', $data, true));

CI 用户指南中有更多信息 - http://codeigniter.com/user_guide/general/views.html

关于PHP (Codeigniter) 电子邮件帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5218545/

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