我在这里阅读了所有类似的问题,并查看了其他网站上的许多示例。
尽管我相信我已正确设置此设置,但我的CSV附件的内容与正文信息一起显示,并显示为附件。附件打开并正确呈现,但消息正文如下所示:
报告附件
payment_reconciliation.csv
客户#,发票,验证人,发布日期,付款#,状态,付款日期,付款金额 " 456272"," 1395164","经过验证 - 由Autumn于2014-04-30 17:15:33","", #&34; 135927""""二零一四年四月三十零日"" 850.00" " 655469"," 1395163","经过验证 - 秋季于2014-04-30 17:13:17","", #&34; 135926""""二零一四年四月三十零日"" 2,275.00" " 351588"," 1395161","经过验证 - 秋天于2014-04-30 17:16:54","", #&34; 135924""""二零一四年四月三十零日"" 595.00" " 78444"," 1395160","已验证 - 由2014年4月30日秋季开始......
以下是创建标题的代码部分:
$myfile = "payment_reconciliation.csv";
$uid = md5(uniqid(time()));
$header = "From: ".$from_name." <".$from_mail.">\r\n";
$header .= "Reply-To: ".$replyto."\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-type:text/html; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $message."\r\n\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-Type: text/csv; name=\"".$myfile."\"\r\n";
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"".$myfile."\"\r\n\r\n";
$header .= $content."\r\n\r\n";
$header .= "--".$uid."--";
mail($to, $subject, $message, $header);
有人发现我失踪的东西吗?谢谢。