----=_nextpart_000_0049_01c180cc.87d17760
content-type: text/plain; charset="gb2312"
content-transfer-encoding: 7bit
content-disposition: inline
------=_nextpart_000_0049_01c180cc.87d17760
content-type: text/html; name="index.html"
content-transfer-encoding: 7bit
content-disposition: attachment; filename="index.html"
<html>
<title>html attachment</title>
<body>
hello, xiaoyz!
</body>
</html>
------=_nextpart_000_0049_01c180cc.87d17760--
//生成邮件头
$header = "from: $from/ncontent-type: multipart/mixed;boundary=/"$boundary/"/nx-mailer:php/nx-priority:3";
//获取上传文件的mime类型
if( $attach_type )
$mimetype = $attach_type;
else
$mimetype = "application/unknown";
//获取上传文件的名字
$filename = $attach_name;
$filename = $attach_name;
//对上传文件进行编码和切分
$fp = fopen($attach, "r");
$content = fread($fp, filesize($content));
$content = chunk_split( base64_encode($content) );
//生成邮件主体
$body ="
--$boundary
content-type: text/plain; charset=iso-8859-1
content-transfer-encoding: 8bit
$message
--$boundary
content-type: $mimetype; name=$filename
content-disposition: attachment; filename=$filename
content-transfer-encoding: base64
$content
--$boundary--";
mail( $to, $subject, $body, $header );
}
?>
新闻热点
疑难解答