0
$content = chunk_split(base64_encode(file_get_contents('test.dpa')));
$uid = md5(uniqid(time()));

$header = "From: mail@mail.com\r\nReply-To: mail@mail.com\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$header .= "This is a multi-part message in MIME format.\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 .= $msg."\r\n\r\n";

$header .= "--".$uid."\r\n";
$header .= "Content-Type: application/octet-stream; name=\"test.dpa\"\r\n";
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"test.dpa\"\r\n\r\n";
$header .= $content."\r\n\r\n";

if( mail($_POST['email'], 'TESTING MAIL', "", $header ) )
    echo "SUCCESS !";
else
    echo "NOPE !";

我想发送带有附件的邮件。我正在$msg从已完成的表格中格式化。- test.dpa - 是一个文件。

我的问题在于声明。为什么声明是 FALSE ?如果我想发送邮件,我会得到“NOPE”结果。但为什么?问题出在哪里?我不明白。

4

0 回答 0