CodeIgniter Forums
Is there a way to create an email attachment on the fly, without an actual file? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Is there a way to create an email attachment on the fly, without an actual file? (/showthread.php?tid=50323)



Is there a way to create an email attachment on the fly, without an actual file? - El Forum - 03-22-2012

[eluser]dallen33[/eluser]
I want to send an HTML email that also includes the HTML as an attachment. The Email class lets you attach files:
Code:
$this->email->attach('/path/to/photo1.jpg');
But what if I want to attach an HTML file without actually writing an HTML file to the file system?


Is there a way to create an email attachment on the fly, without an actual file? - El Forum - 03-22-2012

[eluser]Kamarg[/eluser]
You'd have to extend the email library. The built in email library only workes with files. Alternately, you can write a file, send the email, then delete all the files you created. Not the most elegant way to do it, but it probably takes less time/effort than extending the library.