Export data from table and email it. |
[eluser]Brad K Morse[/eluser]
I am unsure about how to make this happen, I do have it working to export the table to a csv and it forces the download, but that won't be needed when trying to attach it to an email. I also have a function for sending an email. I need help putting these two together to export, then email that csv file. Code: // controller: export The emailCsv controller function I just wrote, but not being used anywhere right now. I am not sure how I can attach the csv file (spreadsheet.csv) to $this->email->attach() within emailCsv Any help is very appreciated.
[eluser]jrtashjian[/eluser]
You need to pass the full server path to the file you want to attach, not just the filename.
[eluser]Brad K Morse[/eluser]
Thanks, I understand that, but what I am unsure about is how to pass the result of export (the csv file), into emailCsv.
[eluser]jrtashjian[/eluser]
You have to write the results as a file somewhere, then attach it. You cannot pass the results directly. The function $this->email->attach() looks for the physical file that you passed as the parameter.
[eluser]Brad K Morse[/eluser]
Makes sense. Too bad there was not a helper file that passed a string into an email as a csv file |
Welcome Guest, Not a member yet? Register Sign In |