发送电子邮件类型

时间:2012-05-21 00:02:46

标签: php html codeigniter

这是发送电子邮件的发送电子邮件功能,但我有两种不同类型的电子邮件(txt,html)。问题是,当它发送到我的雅虎地址时,它发送的html很好但是它显示的是html代码而不是渲染它。我该如何解决这个问题。

/**
* Send email message of given type (activate, forgot_password, etc.)
*
* @param       string
* @param       string
* @param       array
* @return      void
*/
function sendEmail($template, $type, $subject, $userData)
{
    $this->ci->load->library('email');
    $this->ci->email->from('kowmanagement@kansasoutlawwrestling.com', 'Kansas Outlaw Wrestling');
    $this->ci->email->reply_to('kowmanagement@kansasoutlawwrestling.com', 'Kansas Outlaw Wrestling');
    $this->ci->email->to($userData['email']);
    $this->ci->email->subject($subject);
    $this->ci->email->message($this->ci->load->view($template .'/email/'.$type.'-html', $userData, TRUE));
    $this->ci->email->set_alt_message($this->ci->load->view($template .'/email/'.$type.'-txt', $userData, TRUE));
    $this->ci->email->send();
}

1 个答案:

答案 0 :(得分:-1)

尝试 PHPMailer ,功能强大且完整。