0

我有这个 PHP 脚本,它应该允许我将任何文件附加到电子邮件中。但是,似乎每当我尝试用它附加一个更大的文件(比如 4mb)时,我都会收到“邮件错误”消息。有人可以帮忙吗?我可以在 php.ini 中更改任何设置吗?

<!DOCTYPE html><html><head></head>
<body><?php

$boundary=md5(time());
$file1 = chunk_split(base64_encode(file_get_contents('att.zip')));

$msg="
--$boundary
Content-Type: text/html; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit

<h1>This is the HTML mail.</h1>

--$boundary
Content-Type: application/octet-stream; name=\"att.zip\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment

$file1

--$boundary--";

mail("example@yahoo.com",
     "Testing 4",
     $msg,
     "From: admin@yahoo.com\n".
     "MIME-Version: 1.0\n".
     "Content-type: multipart/mixed;\n    boundary=\"$boundary\"") or die("MAIL ERROR");

?> </body></html>
4

0 回答 0