I am using php to process an html form, and the results entered in the web page are then sent to my email. The question i have is how can i receive these resuls in the form of an attachment (such as txt, csv xml..), rather than as part of the email body? Below is the php code i have. -------- <?php $msgtxt = $msgtxt . $_POST['FirstName'] . ','; $msgtxt = $msgtxt . $_POST['LastName'] . ','; $msgtxt = $msgtxt . $_POST['Email'] . ','; $msgtxt = $msgtxt . $_POST['Title'] . ','; $msgtxt = $msgtxt . $_POST['Company'] . ','; $msgtxt = $msgtxt . $_POST['Phone'] . ','; $msgtxt = $msgtxt . $_POST['Country'] . ','; $msgtxt = $msgtxt . $_POST['Comments'] . ','; //Send Mail $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail("myemail@email.com", "Email heading", $msgtxt, $headers); ?> ------------------- Thanks in advance for your reply. I wold appreciate if you show me an example.
fopen() a temp file with flag "w" for writing, fputs() the data, fclose() the file, add more to the headers in the mail() to include the attachment (Content-Disposition: attachment; filename= ... + mime type etc), then send and delete the file.