CodeIgniter Forums
Generate CSV and Email as Attachment - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Generate CSV and Email as Attachment (/showthread.php?tid=64101)



Generate CSV and Email as Attachment - Stewart Shram - 01-14-2016

Hi, I am new to Codeigniter and am looking for a way to create a csv on the fly and email that csv file as an attachment.

Need a bit of a push in the right direction with what code to use if anyone could help.

Thanking you all in advance.


RE: Generate CSV and Email as Attachment - Arti - 01-15-2016

Hi Stewart,

Before some days i was facing same problem, even I am new to code igniter , i have refereed some links and that are working fine for me . you can refer following links

1.http://stackoverflow.com/questions/10663277/how-to-send-an-email-with-content-from-a-view-in-codeigniter
2.http://webrocom.net/generate-excel-file-using-phpexcel-in-codeigniter/
3.http://stackoverflow.com/questions/13108508/how-can-i-attach-the-file-in-codeigniter-which-i-have-created-through-coding


RE: Generate CSV and Email as Attachment - Stewart Shram - 01-15-2016

I have solved this now.

I had to convert multidimensional array in to a string and then use the $this->email->attach() I was then able to send the string and give the attachment a name and mime type.