简体   繁体   中英

Loading a template into an email CodeIgniter

I'm having trouble sending a template email. I'm trying to load a template when sending the email (based on other suggestions i saw on this forum). It looks something like this.

// load Email Library 
    $this->load->library('email');

    $config['mailtype'] = 'html';
    $config['wordwrap'] = TRUE;

    $this->email->initialize($config);
    $message = $this->load->view('template_email', $data, true);
    $this->email->to($to);
    $this->email->from($from);
    $this->email->cc($cc);
    $this->email->subject($subject);
    $this->email->message($message);
    if (!$this->email->send())
    {
        echo $this->email->print_debugger();
    }
    else
    {
        echo "Email Sent";
    }

But i'm getting and error "Unable to load file ...."

Any suggestions ?

try this:

   $message = $this->load->view('email/report',TRUE);

This question could be a posible duplicate. Anyway maybe this link could help you. How to send an email with content from a View in codeigniter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM