我使用php mail()函数发送带附件的电子邮件。
它适用于gmail,但雅虎的附件大小为零(0字节)。
以下是我使用的附件代码:
$xMessage .= "Content-type:text/html; charset=iso-8859-1\r\n";
$xMessage .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$xMessage .= $message."\r\n\r\n";
$xMessage .= "--".$mime_boundary."\r\n";
$xMessage .= "Content-Type: application/octet-stream; name=\"".basename("uploads/attachment_file/".$file['attachment_name'])."\"\r\n";
$xMessage .= "Content-Transfer-Encoding: base64\r\n";
$xMessage .= "Content-Disposition: attachment; filename=\"".basename("uploads/attachment_file/".$file['attachment_name'])."\"\r\n";
$content = file_get_contents("uploads/attachment_file/".$file['attachment_name']);
$xMessage.= chunk_split(base64_encode($content));
$xMessage .= "\r\n\r\n";
我还应该如何在雅虎获取附件?
答案 0 :(得分:-1)
将/ r / n更改为
$eol = PHP_EOL;
并更改
"Content-Disposition: attachment; filename=\"".basename("uploads/attachment_file/".$file['attachment_name'])."\"\r\n";
到
"Content-Disposition: attachment; filename=\"".basename("uploads/attachment_file/".$file['attachment_name']).$eol.$eol;