html 电子邮件不在 codeigniter 中发送

标签 html codeigniter email smtp

这是我发送 HTML 电子邮件的代码,但它无法正常工作。电子邮件中仅显示原始 html 代码。

        $emailID = $this->input->post('email');
        $name = $this->input->post('name');

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

        $config['protocol'] = 'smtp';
        $config['mailtype'] = 'html';
        $config['crlf'] = "\r\n";
        $config['wordwrap'] = TRUE;
        $config['newline'] = "\r\n";
        $config['validate'] = FALSE;

        $this->email->set_newline("\r\n");
        $this->email->from($emailID,$name);
        $this->email->to('vishvajitmahida009@gmail.com');
        $this->email->subject('Email Testing');
        $this->email->message('from clientside mail'); 
        $this->email->send();  

        $message = $this->load->view('emailfile/file','',TRUE);             
        $this->load->library('email', $config);
        $this->email->from($emailID,$name);
        $this->email->to($emailID,$name);
        $this->email->subject('Email Testing');
        $this->email->message($message);   
        $this->email->send();
        //echo $this->email->print_debugger();

最佳答案

添加$this->email->initialize($config);:

$this->load->library('email');  
$config['protocol'] = 'smtp';
$config['mailtype'] = 'html';
$config['crlf'] = "\r\n";
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n";
$config['validate'] = FALSE;
$this->email->initialize($config);

关于html 电子邮件不在 codeigniter 中发送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36474476/

相关文章:

安卓 Intent : Send an email with attachment

html - 确保 HTML 电子邮件始终显示图像

php - 如何使用 PHPMailer 向 Mailcatcher 发送电子邮件?

javascript - Jquery使用函数返回值

html - 使用 CSS3 将 JPG 图像淡入透明

php - 如何逐步将站点转换为 CodeIgniter?

php - 基于单选按钮状态的链接点击动态 href 生成 : PHP interaction with javascript

javascript - 加算术运算

html - 当下拉菜单上的元素悬停在父元素上时,文本颜色会发生变化

php - 获取数组中的下一个元素 (PHP)