Ciao a tutti!! Ho realizzato uno script che prendere dei dati da una tabella sql e crea al volo un file excel , come posso fare in modo che questo file creato al volo venga spedito ad un specifico indirizzo email?

Questo è il codice che uso :

Codice PHP:
$filename="indirizzi.xls";
header ("Content-Type: application/vnd.ms-excel");
header ("Content-Disposition: inline; filename=$filename");

mysql_connect("$hostiname","$username","$password") or die("Impossibile collegarsi al server");
mysql_select_db("$database") or die("Impossibile selezionare il database");

echo
"<TABLE>";
echo
"<tr><td>Nome</td><td>Cognome</td><td>Indirizzo</td></tr>";

$dati=mysql_query("select * from rivs");

$NumEntries=mysql_num_rows($dati);
while(
$array=mysql_fetch_array($dati)){

echo
"<tr><td>$array[nome]</td><td>$array[cognome]</td><td>$array[indirizzo]</td></tr>";
}
echo
"</TABLE>";