我正在通过表格将简历发送到邮件,但无法发送邮件...请检查我的代码
这是我的表格:
<form action="Careers.php" method="post" enctype="multipart/form-data" id="uploadForm">
Name<br />
<input type="text" name="cf_name" class="input"/><br />
E-mail<br />
<input type="text" name="cf_email" class="input"/><br />
Upload your Resume<br />
<input type="file" name="attachment" size="40"/><br />
<input type="submit" value="Send" id="upload" class="color1"/>
</form>
这是我的 Careers.php:
<?php
$strTo="bhargavi@genyedu.com";
$strSubject = 'Job Application from a site visitor ';
//*** Uniqid Session ***//
$strSid = md5(uniqid(time()));
$strHeader = "";
$strHeader .= "From: ".$_POST["cf_name"]."<".$_POST["cf_email"].">\nReply-To: ".$_POST["cf_email"]."";
$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";
//*** Attachment ***//
if($_FILES["attachment"]["name"] != "")
{
$strFilesName = $_FILES["attachment"]["name"];
$strContent = chunk_split(base64_encode(file_get_contents($_FILES["attachment"] ["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,null,$strHeader); // @ = No Show Error //
if($flgSend)
{
echo "Mail send completed.";
}
else
{
echo "Cannot send mail.";
}
?>
我没有收到任何错误...但它说无法发送邮件...为什么我不知道...请帮助我。
如果我删除“@”符号,那么我会得到休闲错误:
Warning: mail() [<a href='function.mail'>function.mail</a>]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\WebsiteTemplate3\Careers.php on line 63
嗨...我禁用了 smtp 服务器身份验证...现在它说成功但我没有收到任何邮件...但它说成功...请告诉我