PHP Headers for Sending CSV File Downloads
If you would like to force a file download prompt to the user, instead of just outputting the text to the browser, use the following headers.
Using the PHP Mail Function with Additional Headers
Pass a fourth parameter to the mail() function with the header information.
$to = "firstname.lastname@example.org";
$subject = "Hello World!";
$body = "This will be sent from email@example.com";
$headers = "From: firstname.lastname@example.org\r\nX-Mailer: php";...