dongsiju1941 2014-01-20 08:28
浏览 166
已采纳

Codeigniter - 电子邮件类 - HTML电子邮件加载视图

I need to send an HTML email but in the message I add to load a HTML file from the view, but when I send email and receive it, but email is blank no text getting from the view file please suggest.

public function sendUserMail($mail) {
            $data=true;
            $lang = $this->input->post("lang");
            $this->email->from('noreply@giftotravel.pk', 'Halalat');
            $this->email->to($mail); 
            $this->email->subject('Halalat Newsletter Subscription');
            $this->email->set_mailtype("html");
             if ($lang == "en") {
            $this->email->message = $this->load->view('email', $data, TRUE);
            }
            else  
            {
            $this->email->message('<img src="http://fahad.myradio.pk/assests/images/ar/bg_ar3.jpg" />');   
            }
            //$this->email->attach('/home/content/f/a/h/fahadghafoor/html/fahad/assests/images/en/bg_en2.jpg');//attachement testing done
            $this->email->send();
            echo $this->email->print_debugger();
        }
  • 写回答

2条回答 默认 最新

  • dsuw85815 2014-01-20 08:35
    关注

    Setting the email message should be like this:

    $this->email->message($this->load->view('email', $data, TRUE));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?