Welcome Guest, Not a member yet? Register   Sign In
Inline images in Email class
#1

[eluser]dandys997[/eluser]
Hi,
I need to attach and use inline images in HTML email sending via Email class. I found this topic: http://ellislab.com/forums/viewthread/144855, but it's modification of previous version of CI. I need to do it with CI 2.1.0.
I know that there's a post under topis linked above (http://ellislab.com/forums/viewthread/144855/#979984), but I can't see any attachments, so I can't use it.
How to extend CI Email class to reach inline images? Thanks in advance for help!
#2

[eluser]InsiteFX[/eluser]
Embbed Inline Images with CodeIgniter Email Class
#3

[eluser]dandys997[/eluser]
OK, I solved the problem.

Here is the answer: http://ellislab.com/forums/viewthread/186606/

I've compared Email.php library linked above with current (2.1) CodeIgniter Email.php class and created its extension: http://pastebin.com/VxMrzzq2. Just put it in application/libraries/MY_Email.php - now you can attach inline files in this way:

Code:
$this->email->attach("filename.jpg", "inline");

This extension care about replacement of file name with cid value.

Don't forget to set the "multipart" config key to "related" in application/config/email.php:

Code:
$config["multipart"]="related";
#4

[eluser]Dan Tdr[/eluser]
Hello dandys997,
I did what you said but still i can`t get it to work, i get an error: lang:email_attachment_missing even though i give the right path to the file.
Code:
$this->data->test= '<img src="cid:logo.png" />';
   $this->email->attach('C:\\logo.png');
  
   $msg = $this->load->view('email/quiz.tpl.php', $this->data, true);




Theme © iAndrew 2016 - Forum software by © MyBB