简体   繁体   English

将模板加载到电子邮件CodeIgniter中

[英]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 如何在Codeigniter中发送包含内容的电子邮件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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