Hi folks,
The code below has been sending CSVs to our print fulfillment folks for years. Beginning of the week the sysadmin switched from sendmail to qmail for reasons having to do with procmail recipes we want to run.
Probably not coincidentally we starting started hearing that the fulfillment folks were seeing empty CSVs even when others CCed on the mail saw the records. Folks with the issue were seeing the attachment and could open it but their MUI was listing it as 131 bytes or zero bytes.
We started sending to a Yahoo address with same results. However Gmail sees attachment with correct rows. Mind you this is all one CCed email with different results depending on mail clients.
I have gone over the code in vi and made sure there were no ^M chars or other control character junk.
Anyone seen this before? Any suggestions most welcome!
Thanks!
JG
$message = "Here is the file (comma-separated values) of addresses for\n";
$message .= $pm_row['title'] . " Requests ($now_YmdHMS).\n\n";
$data_email = $pm_row['fulfillment_data_email'];
$data_email_cc = "$pm_row[fulfillment_data_email_cc],$developer_email";
$subject = $pm_row['title'] . " Requests ($now_YmdHMS)";
$random_hash = md5(date('r', time()));
$headers = "From: XXX <[email protected]>\r\nReply-To: [email protected]\r\nCc:$data_email_cc";
$headers .= "\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
$attachment = chunk_split(base64_encode(file_get_contents($filename)));
$output = "
--PHP-mixed-$random_hash;
Content-Type: multipart/alternative; boundary='PHP-alt-$random_hash'
--PHP-alt-$random_hash
Content-Type: text/plain; charset='iso-8859-1'
Content-Transfer-Encoding: 7bit
$message
--PHP-alt-$random_hash
Content-Type: text/html; charset='iso-8859-1'
Content-Transfer-Encoding: 7bit
$message
--PHP-alt-$random_hash--
--PHP-mixed-$random_hash
Content-Type: application/zip; name=$now_YmdHMS.$pm_row[handle].csv
Content-Transfer-Encoding: base64
Content-Disposition: attachment
$attachment
--PHP-mixed-$random_hash--";
mail($data_email, $subject, $output, $headers);