Sp我試圖發送一封電子郵件,代碼工作正常,直到我從標準電子郵件切換到html電子郵件。加載「發送電子郵件」頁面時出現500錯誤
這是住在這裏:http://kenthomes.net/Amelia-Cove
點擊 「共享此計劃」。
我的代碼是:
$person = $_POST["name"];
//Where will you be pulling emails from?
$emailDB = "emailAddresses";
$type = $_POST["type"];
//Get Share URL that is misformatted.
$waybefore = $_GET["share"];
$before = str_replace("*", "?", $waybefore);
$shareMe = str_replace("!", "=", $before);
$id = $_SERVER['HTTP_REFERER'];
$id = $_SERVER['HTTP_REFERER'];
//Where do you want a copy of this email to go to? (or null)
$copyDB = "";
if($_GET["com"])
{
$prettyType = "Community";
}
else if($_GET["inv"])
{
$prettyType = "Move-In Ready Home";
}
else if($_GET["mod"])
{
$prettyType = "Model Home";
}
$_POST["date"] = date("Y-m-d");
$Emails = new Controller($emailDB, null, null, true);
$ed = $Emails->getData();
//
// The good stuff
//
$emailTo = $_POST["email"];
$subject = "Kent Homes - " . $person . " would like to share a " . ucwords(strtolower($_GET['type'])) . " with you!";
$out = '<html><body>';
$out .= $person . " thought you would like this " . $prettyType . " by Kent Homes. Click the link to view: http://kenthomes.net" . $shareMe . "</br></br>";
$out .= "Additional Message from " . $person . "</br>";
$out .= $_POST['msg'];
$out .= '</body></html>';
$headers = "From: " . $person "<[email protected]>\r\n";
$headers .= "Reply-To: <[email protected]\r\n";
$headers .= "X-Mailer: PHP/" . phpversion()."\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
//
// Send 'er off!
//
mail($emailTo, $subject, $out, $headers);
if($toEmail) {
mail($emailTo, $subject, $out, $headers);
}
echo "<p>This " . ucwords(strtolower($_GET['type'])) . " has been sent to " . $_POST["email"] . ".</p>";
unset($_POST["id"]);
我得到錯誤:
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.
這是功能代碼是什麼樣子的HTML郵件的東西之前:
$Captcha = new MCaptcha();
if($_POST["submitit"])
{
$answer = $Captcha->checkAnswer();
if($answer)
{
$person = $_POST["name"];
$emailTo = $_POST["email"];
$subject = "Kent Homes - " . $person . " would like to share a " . ucwords(strtolower($_GET['type'])) . " with you!";
//Where will you be pulling emails from?
$emailDB = "emailAddresses";
$type = $_POST["type"];
//Get Share URL that is misformatted.
$waybefore = $_GET["share"];
$before = str_replace("*", "?", $waybefore);
$shareMe = str_replace("!", "=", $before);
$id = $_SERVER['HTTP_REFERER'];
$id = $_SERVER['HTTP_REFERER'];
//Where do you want a copy of this email to go to? (or null)
$copyDB = "";
if($_GET["com"])
{
$prettyType = "Community";
}
else if($_GET["inv"])
{
$prettyType = "Move-In Ready Home";
}
else if($_GET["mod"])
{
$prettyType = "Model Home";
}
$out = $person . " thought you would like this " . $prettyType . " by Kent Homes. Click the link to view: http://kenthomes.net" . $shareMe . " ";
$_POST["date"] = date("Y-m-d");
$Emails = new Controller($emailDB, null, null, true);
$ed = $Emails->getData();
mail($emailTo, $subject, $out, $headers);
if($toEmail) {
mail($emailTo, $subject, $out, $headers);
}
echo "<p>This " . ucwords(strtolower($_GET['type'])) . " has been sent to " . $_POST["email"] . ".</p>";
unset($_POST["id"]);
}
}
那麼你的'error_log'說? '$ toEmail'設置爲你的'if($ toEmail){'check?看起來像兩次相同的「mail()」調用。 –
是的,出於某種原因,當我刪除該聲明,如果聲明是奇怪的,我知道它沒有發送電子郵件。 –
這可能是你問題的根源。 –