im working in a php project in witch i have to send a mail with an excel attachment , for the mail im using phpmailer. Im having a problem with the format of the excel file that the code below produces.
$table.='<table></table>';
    if (file_exists("EXCEL REPORT/".$subject." ".date("M-d-Y").".xls")) 
    {
        unlink("EXCEL REPORT/".$subject." ".date("M-d-Y").".xls");
        file_put_contents("EXCEL REPORT/".$subject." ".date("M-d-Y").".xls", $table); 
        sendmailatt($to,$cc,$subject." ".date("M-d-Y"),"mail",<br>REGIA","EXCEL REPORT/".$subject." ".date("M-d-Y").".xls");
    } 
    else {
       file_put_contents("EXCEL REPORT/".$subject." ".date("M-d-Y").".xls", $table); 
       sendmailatt($to,$cc,$subject." ".date("M-d-Y"),"Questo e' un invio automatico del venduto per agent.<br><br>Saluti,<br>REGIA","EXCEL REPORT/".$subject." ".date("M-d-Y").".xls");
    }
i want to convert the attachment into excel 2007 before sending the mail... is there any easy way for achieving this