我试图在网上和网上搜索答案,我可能只是在这里找不到一些东西。
我有一个热门的网站(不是wamp或任何东西)。 我写了非常简单的电子邮件功能来发送附件。 由于某种原因,我没有错误,没有结果。
这是PHP
if(isset($_POST['Submit'])){
$strTo = "my@mail.com";
$strSubject = "Purchase request from " . $_POST["formName"] . $_POST["formSurname"];
$strMessage = nl2br($_POST["formName"] . $_POST["formEmail"] . $_POST["formInstitute"] . $_POST["formCourse"] . $_POST["formNotes"]);
//*** Uniqid Session ***//
$strSid = md5(uniqid(time()));
$strHeader = "";
$strHeader .= "From: ".$_POST["formEmail"]."<".$_POST["formEmail"].">\nReply-To: ".$_POST["formEmail"]."";
$strHeader .= "MIME-Version: 1.0\n";
$strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
$strHeader .= "This is a multi-part message in MIME format.\n";
$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-type: text/html; charset=utf-8\n";
$strHeader .= "Content-Transfer-Encoding: 7bit\n\n";
$strHeader .= $strMessage."\n\n";
//*** Attachment ***//
if($_FILES["fileAttach"]["name"] != "")
{
$strFilesName = $_FILES["fileAttach"]["name"];
$strContent = chunk_split(base64_encode(file_get_contents($_FILES["fileAttach"]["tmp_name"])));
$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n";
$strHeader .= "Content-Transfer-Encoding: base64\n";
$strHeader .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
$strHeader .= $strContent."\n\n";
}
$flgSend = mail($strTo,$strSubject,$strMessage,$strHeader); // @ = No Show Error //
if($flgSend)
{
echo "<p>works</p>";
}
else
{
echo "<p>not working</p>";
}
}
?>
表格在不同的页面上:
<form action="#!/studentform.2ndpahse" method="post" name="form1" enctype="multipart/form-data">
<table width="500">
<tr>
<td>שם פרטי: </td>
<td><input name="formName" type="text" id="name"></td>
</tr>
<tr>
<td>שם משפחה: </td>
<td><input name="formSurname" type="text" id="surname"></td>
</tr>
<tr>
<td>דואר אלקטרוני: </td>
<td><input name="formEmail" type="text"></td>
</tr>
<tr>
<td>מוסד אקדמי: </td>
<td><input name="formInstitute" type="text"></td>
</tr>
<td>מסלול: </td>
<td><input name="formCourse" type="text"></td>
</tr>
<tr>
<td>הערות</td>
<td><textarea name="formNotes" cols="30" rows="4" id="formNotes"></textarea></td>
</tr>
<tr>
<td>Attachment</td>
<td><input name="fileAttach" type="file"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="שלח"></td>
</tr>
</table>
</form>
将获得任何给予的帮助
答案 0 :(得分:0)
最终是托管问题并由他们解决。