如何在Codeigniter中的电子邮件中显示图像? [英] How to display an image in email in codeigniter?
本文介绍了如何在Codeigniter中的电子邮件中显示图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$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();
尝试在消息中包含在内,还尝试作为内联附件,但两者均无效。我需要的是在发送电子邮件时&
Tried including in message and also tried as inline attachment,but both didn't work. What i need is when an email is sent & on opening it,the image should be seen.
当前,我收到如下所示的电子邮件
Currently I am receiving email as given below
$remarks.'/n <img src="<?php echo base_url();?>images/promotions/<? echo $image; ?>" style="float: left;margin-top: -11px;width: 100px;margin-left:10px;" />')
推荐答案
感谢abdulla的帮助。我以如下方式尝试过。
Thanks abdulla for the help. I tried in different way as below.
$ mail_body = $ this-> load-> view('email_template / promo_email',$ data,TRUE);
$mail_body = $this->load->view('email_template/promo_email', $data, TRUE);
$this->load->library('email');
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from('another@another-example.com', 'Admin');
$this->email->to('them@their-example.com');
$this->email->subject($subject.' Promotion');
$this->email->message($mail_body);
$this->email->send();
这篇关于如何在Codeigniter中的电子邮件中显示图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文