无法通过codeigniter电子邮件函数发送html表单

1u4esq0p  于 2022-12-30  发布在  其他
关注(0)|答案(1)|浏览(136)

我尝试使用CodeIgniter邮件功能来传输联系表单的详细信息,但是当我发送时,我无法发送任何HTML内容,它中断了。
这是我通过电子邮件output获得的输出
我已经试过这个代码

public function send_mail() {
        $to = "test@test.com";
    $fname = $this->input->post('fname');
    $lname = $this->input->post('lname');
    $email = $this->input->post('email');
    $phone = $this->input->post('phone');
    $esubject = $this->input->post('esubject');
    $msg = $this->input->post('msg');
    $ip= $_SERVER['REMOTE_ADDR'];
    $this->load->library('email');
     //echo $fname.'<br>'.$lname.'<br>'.$email.'<br>'.$phone.'<br>'.$esubject.'<br>'.$msg; exit;
    $this->email->from($email);
    $this->email->to($to);
    $this->email->subject(' Contact Form');
    $this->email->message($fname.'<br>'.$lname.'<br>'.$email.
        '<br>'.$phone.'<br>'.$esubject.'<br>'.$msg.$ip);
    //Send mail
    // $this->load->library('session');
       if($this->email->send())
             {
              echo 'Email send.';
             }
             else
            {
             show_error($this->email->print_debugger());
            }
     $this->load->view('contact');
    }
uqzxnwby

uqzxnwby1#

$this->load->library('email');
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$this->email->initialize($config);

为我工作

相关问题