I'm using MIME to send a html email and i wanted to attach an excel sheet that will be generated from My SQL database to that email.
can you help me on how can i generate and attach that excel sheet to emails that my script sends?
I like to use PHPMailer and just call the applicable methods, because I'm lazy. (Use the preceding link to download the PHP5-compatible version, as the link on their web site points to the PHP4 version.)
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
I'm guessing you also require the ability to create the Excel Spreadsheet using PHP?
Although I've never tried it fully, you can start by looking at something like COM.
$excel = new COM('Excel.Application');
Then start adding sheets, data, styling the columns and saving the file to the filesystem.
I tried the code above and it created an Excel instance in the background, obviously on my Windows computer. I only have working examples on creating spreadsheets using Visual Basic, but I'm sure the concept is the same with the PHP variant.
I like to use PHPMailer and just call the applicable methods, because I'm lazy.
I'm lazy as well but rather than put up with any limitations a 3rd party application might have, I give the user a form with a tinyMCE text editor for them to write their html email content and the option to upload attachments. The code in the tute does the rest when the form data including target email addreses is submited to it.
This way I can customise the form and php script to however I like and then simply bolt it on to any other php application.