[英]I have a contact form that is sending blank emails?
在我們開始之前,我是一個完整的新手!
我有一個使用PHP為我創建的聯系表單。 我已將代碼嵌入到我的電子郵件html中並更改了php文件中的電子郵件地址。
創建它的人說它在他們的服務器上工作正常,並已發送電子郵件證明它確實如此。
點擊提交后,電子郵件會通過,但它是空白的,有什么想法嗎?
PHP代碼(文件名simple-mailprocess_v2
):
<?
$to= ('info@cre8ivo.co.uk');
$subjectline= ('Website - form enquiry - Speak to a private medical insurance specialist');
$thanks=('thankyou.html');
$return=('Location:'.$thanks);
if (sizeof($_POST)) {
$body = "";
while(list($key, $val) = each($HTTP_POST_VARS)) {
$body .= "$key: \n $val \n\n";
// Check if all fields have been filled in
if(empty($val)) {
echo ("<b><li>either one or more required fields have not been completed. Go <a href='javascript: history.go(-1)'>Back</a> and try again</li></b>");
exit();
}
}
}
// Secure the headers
$security = "From: \r\n";
$security .= "Reply-To: \r\n";
$security .= "Return-Path: \r\n";
$security .= "CC: \r\n";
$security .= "BCC: \r\n";
// Send the email.
if ( mail($to,$subjectline,$body,$security) ) {
header($return);
} else {
echo "The email has failed!";
}
?>
任何幫助深表感謝!
任何更多信息需要我提供,不知道它需要什么抱歉!
非常感謝,簡。
嘗試將$ HTTP_POST_VARS更改為$ _POST ..
$ HTTP_POST_VARS [已棄用] - > 來自php
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.