codeigniter发送标识不起作用的电子邮件

时间:2016-11-21 11:51:46

标签: codeigniter-3

我正在使用CI版本3,并且我使用内置的电子邮件功能发送HTML电子邮件模板。

我的代码如下:

public function send_email($sendTo, $fromName, $fromEmail, $data, $subject) {
    $this->email->set_mailtype('html');
    $this->email->from($fromEmail, $fromName);
    $this->email->to($sendTo);
    $this->email->subject($subject);
    $this->email->attach(FCPATH . "images/logo.png", "inline");
    $content = array(
        'HTMLcontent' => $data
    );
    $body = $this->load->view('email_template.php', $content, TRUE);
    $this->email->message($body);
    if ($this->email->send()) {
        return TRUE;
    } else {
        return FALSE;
    }
}

FCPATH可以显示:/ home / myuser / public_html /我在public_html中有图像文件夹

email_template.php

<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <body>
        <table>
            <tr>
                <td>
                    <a href="" target="_blank">
                        <img src="cid:logo.png" width="144" height="76" border="0" alt="logo"/>
                    </a>
                </td>
            </tr>
        </table>
    </body>
</html>

当电子邮件出现时,它会显示缺少的徽标,如下图所示

missing logo

0 个答案:

没有答案