$this->load->library('upload');
$this->load->library('email');
$this->email->set_newline("\r\n");
$this->email->from($email);
$this->email->to($cus_email);
$this->email->subject($promo_name.' Offers');
$this->email->message($remarks.'/n <img src="<?php echo base_url();?>images/promotions/<? echo $image; ?>" style="float: left;margin-top: -11px;width: 100px;margin-left:10px;" />');
// $this->email->attach($img,'inline');
// $this->email->attach($img);
$this->email->send();
尝试包含在消息中,也尝试作为内联附件,但两者都不起作用。我需要的是当发送电子邮件并打开它时,应该看到图像。
目前我收到如下电子邮件
$remarks.'/n <img src="<?php echo base_url();?>images/promotions/<? echo $image; ?>" style="float: left;margin-top: -11px;width: 100px;margin-left:10px;" />')
方法01(代码点火器)
将图像上传到您的服务器。
In your 正在发送电子邮件的控制器,添加这一行:
$this->email->attach("/home/yoursite/location-of-file.jpg", "inline");
然后在电子邮件视图添加这个:
<img src="cid:location-of-file.png" border="0">
And location-of-file.jpg
将更改为该资源的内容 ID。
其他事情也会起作用,例如...src="
, ...href="
, url('')
方法02(标准)
$to = '[email protected] /cdn-cgi/l/email-protection';
$subject = 'Mail With Inline Image';
$message = 'This is first line';
$message .= 'This is Second line';
$message .= '<img src="http://example.com/images/filename.jpg" alt="my picture">';
$header = 'MIME-Version: 1.0';
$header .= 'Content-Type: text/html; charset="ISO-8859-1';
mail($to, $subject,$message,$header)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)