以下代码多年来一直向我们的印刷履行人员发送CSV。本周开始,系统管理员从sendmail切换到qmail,原因是与我们想运行的procmail配方有关。某些邮件客户端在从sendmail切换到qmail后,会从PHP邮件()中看到空的CSV附件
大概不是巧合,我们开始听到履行人员看到空的CSV,即使其他人在邮件上看到记录时也是如此。有问题的人看到附件并可以打开它,但他们的MUI将其列为131字节或零字节。
我们开始发送到雅虎地址,结果相同。不过,Gmail会使用正确的行查看附件。请注意,这是根据邮件客户端的不同结果的所有CCed电子邮件。
我已经在vi中的代码,并确保没有^ M字符或其他控制字符垃圾。
以前有人看过这个吗?任何建议最受欢迎!
谢谢!
$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);
我原本一个Perl的人辩论。当Perl是你的锤子时,这个世界看起来就像是世界。感谢您的链接和信息! – jerrygarciuh 2010-07-13 14:30:19