![](/img/trans.png)
[英]Email Attachments using php mail() function - Working for gmail but attachments are of null size (0 bytes) for other mailing provider
[英]Email Attachments using php mail() function - Working for gmail but attachments are of null size (0 bytes) for yahoo
我正在使用php mail()函数发送带有附件的电子邮件。
它适用于gmail,但yahoo的附件大小为零(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";
我还应该怎么做才能在Yahoo中获得附件?
将/ 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;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.