使用codeigniter发送html邮件 [英] send html mail using codeigniter

查看:104
本文介绍了使用codeigniter发送html邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在codeigniter使用SMTP的邮件内容错误
实际上,我的邮件发送与 HTML 标签,它显示 HTML 标记不正确。

Error in mail content using SMTP in codeigniter Actually, my mail is sent with HTML tags and it is showing the HTML tags which is not correct.

$config = Array(
'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => 'user@gmail.com',
        'smtp_pass' => '',
        'mailtype'  => 'html', 
        'charset' => 'utf-8',
        'wordwrap' => TRUE

    );
    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");
    $email_body ="<div>hello world</div>";
    $this->email->from('user@gmail.com', 'ddd');

    $list = array('user@gmail.com');
    $this->email->to($list);
    $this->email->subject('Testing Email');
    $this->email->message($email_body);

    $this->email->send();
    echo $this->email->print_debugger();

如果在不使用SMTP的情况下发送邮件,我的错误是什么?

If am sending mail without using SMTP it works fine. What is my mistake?

推荐答案

您可以尝试这行代码,将邮件类型设置为 HTML

You can try this line of code which will set the mail type to be for HTML:

 $this->email->set_mailtype("html");

这篇关于使用codeigniter发送html邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆