我正在尝试发送带有多个附件的电子邮件。
这是一个例子:
$uid = md5(uniqid(time()));
$header = "From: Test <test@test.com>\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"\r\n\r\n";
$header .= "--" . $uid . "\r\n";
$header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= "Test Email\r\n\r\n";
$header .= "--" . $uid . "\r\n";
$header .= "Content-Type: text/x-csv; name=\"1.csv\"\r\n";
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"1.csv\"\r\n\r\n";
$header .= $csvfile1 . "\r\n\r\n";
$header .= "--" . $uid . "--";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= "Test Email\r\n\r\n";
$header .= "--" . $uid . "\r\n";
$header .= "Content-Type: text/x-csv; name=\"2.csv\"\r\n";
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"2.csv\"\r\n\r\n";
$header .= $csvfile2 . "\r\n\r\n";
$header .= "--" . $uid . "--";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= "Test Email\r\n\r\n";
$header .= "--" . $uid . "\r\n";
$header .= "Content-Type: text/x-csv; name=\"3.csv\"\r\n";
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"3.csv\"\r\n\r\n";
$header .= $csvfile3 . "\r\n\r\n";
$header .= "--" . $uid . "--";
我在 csv 文件的末尾得到了一些奇怪的字符,如下所示:
w־סֽד·ֽסמ׳fק־ןo,
‰z{©}ךֺxn+¢”j״¶'Eט²¶*Jײֻrֵz°¶+·$j״¶'5ל†·u+¶+‰ֻ{²װj״¶',
可能是什么问题呢?
谢谢。