我有一个发送空白电子邮件的联系表格?

时间:2012-10-04 07:37:53

标签: php forms contact-form

在我们开始之前,我是一个完整的新手!

我已经使用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!";
   }
?>

非常感谢任何帮助!

我需要提供更多信息,不确定需要什么抱歉!

非常感谢, 简

1 个答案:

答案 0 :(得分:2)

尝试将$ HTTP_POST_VARS更改为$ _POST ..

$ HTTP_POST_VARS [已弃用] - &gt; from php