Email showing html source when i send email using codignator email class

后端 未结 2 1990
日久生厌
日久生厌 2020-12-11 22:37

I have a problem in sending html mail with attachment in codeignitor using codeignitor email class the mail showing html code instead of html view.

i had set the mai

2条回答
  •  旧时难觅i
    2020-12-11 23:21

    [Apologies to all, I don't have enough rep to comment for clarification]

    I just tried your exact code (minus the attachment bits) and all worked fine sending HTML email to a Gmail account, I'll provide my full working class below:

    class rohithipix extends CI_Controller {
    
        public function html_email() {
    
            $message = "

    start

    test

    "; $mail_to = "test@gmail.com"; $from_mail = 'test2@gmail.com'; $from_name = 'dave'; $reply_to = 'test2@gmail.com'; $subject = "Abstract Details"; //$file_name = $datamail['varafile']; //$path = realpath('uploads/abstract'); // Read the file content //$file = $path . '/' . $file_name; $config = array( 'protocol' => 'sendmail', 'mailtype' => 'html', 'charset' => 'utf-8', 'priority' => '1' ); $this->load->library('email', $config); $this->email->set_newline("\r\n"); $this->email->from($from_mail, $from_name); $this->email->to($mail_to); $this->email->subject($subject); $this->email->message($message); //$this->email->attach($file); if ($this->email->send()) { echo "Mail send successfully"; } else { echo "Error in sending mail"; } } }

    What email client are you attempting to send these to while testing?

提交回复
热议问题