How do I send an attachment with php mail
<p>I have already exported a xls file but i want to mail this xls file in an attachment of the mail.</p>

<p>exportexcel.php</p>

<pre><code>&lt;?php
session_start();


//export format
$fileNamed = $username."_".$date_time; 
header ("Content-type: application/x-msexcel"); 
header ("Content-Disposition: attachment; filename=$fileNamed.xls" ); 
header ("Content-Description: PHP/INTERBASE Generated Data" );

echo $data;
?&gt;
</code></pre>

<p>the above php file exports in xls what ever is in $data. But i want to mail this xls file in a mail with attached xls file.</p>
