• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Email html with images

#1
Hi everyone,

I am trying to send an email with a hml message that contain images (e.g. logo image). How can i do that?

I tried to attach the image and reference only the name of file in html img..did not work. I tried to have the image from a link, but did not work because the path in site with images can't be accessed directly.

Thanks.
Reply

#2
Include the same url as when you would display the image on your website.

E.g.:
PHP Code:
<img src="<?= base_url('./media/images/example.jpg');?>" /> 

Put the content of your e-mail inside a view.
Load the view as a string:

PHP Code:
$msg $this->load->view('email/example1',TRUE);

$this->load->library('email');
$this->email->to('[email protected]');
$this->email->from('[email protected]');
$this->email->subject('Test');
$this->email->message($msg);
$this->email->send(); 
Reply

#3
A image set through URL is possible.

I guess you want an attached image file to be shown as an embedded image within the text? Like:
Slogan <img src="cid:logo_src" /> Text Text ... ?
I haven't checked recently, but I doubt that such a feature is supported by CI_Email class.
Reply

#4
(10-27-2017, 03:02 PM)ivantcholakov Wrote: A image set through URL is possible.

I guess you want an attached image file to be shown as an embedded image within the text? Like:
Slogan <img src="cid:logo_src" /> Text Text ... ?
I haven't checked recently, but I doubt that such a feature is supported by CI_Email class.

Thanks Ivantcholakov and others,

I found the problem... after put site online, it worked fine. One problem was that the files are case sensitive and the picture extension was .PNG, while I was trying to access .png.!
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.