• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Image Embedded Email Body - Code Igniter

#1
I'm having difficulty attaching an image to the body of the email using a standard library of the igniter code.
I already did this:
Code:
$cid = $this->email->attach('media/teste.jpg','inline');
$data['cid']= $cid;
$emailbody = $this->load>view('test/template.php',$data,true);
$this->email->message($emailbody);

view:
Code:
<img src='cid:<?= $cid?>' alt="photo1" height="42" width="42" />'

In case the attachment happens, but in the view the image in the body does not appear.
Can anyone help?
Reply

#2
For emails you need the full path to the image file.

(http:// or https://).
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
I think it is very much similar with your query follow this https://stackoverflow.com/questions/3184...odeigniter
Reply

#4
Thank you all for your help.

I was able to sort through the documentation.

https://www.codeigniter.com/user_guide/l...email.html

$filename = '/img/photo1.jpg';
$this->email->attach($filename);
foreach ($list as $address)
{
       $this->email->to($address);
       $cid = $this->email->attachment_cid($filename);
       $this->email->message('<img src="cid:'. $cid .'" alt="photo1" />');
       $this->email->send();
}
Reply

#5
(08-09-2018, 10:54 AM)vitor1415 Wrote: Thank you all for your help.

I was able to sort through the documentation.

https://www.codeigniter.com/user_guide/l...email.html

$filename = '/img/photo1.jpg';
$this->email->attach($filename);
foreach ($list as $address)
{
       $this->email->to($address);
       $cid = $this->email->attachment_cid($filename);
       $this->email->message('<img src="cid:'. $cid .'" alt="photo1" />');
       $this->email->send();
}


Hi, your query was about using a template and here you are not using one. I am using a template and struggling to get the images embedded. Appreciate if you could help me in fixing this issue. Thanks
Reply

#6
Did you manage to embed image while using an email template? The above works but not in case of template. Appreciate your help.
Reply

#7
Maybe this will help you with an email template.

Notice the $data array...

How to send email using HTML templates in Codeigniter
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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