PHP不发送电子邮件,留在空白页

时间:2015-12-13 00:41:18

标签: php html forms email form-submit

我尝试了几种版本的php表单邮件程序,但无法使用它们中的任何一种。我试图将其设置为当用户单击“提交”时,表单上的信息将自动发送/填充在电子邮件中。目前,没有发送任何电子邮件,它将保留在黑色网站xxxx.com/contact.php上。即使在阅读了许多其他类似的帖子之后,我一直试图解决这个问题一周无济于事

这是我的html表单:

    <form method='post' action='contact.php'>
            <br>
            <br>
            <br>
            <br>

    <h2>
        Contact Us Form
    </h2>
    <table>
        <tr>
            <td>
    <p>
        Fill out the form below with your contact information and questions/comments and click submit.
        We will respond to your inquiry as soon as possible via email. If you prefer a different contact
        method then please provide required information and notate your preference in the comments section.
        I look forward to providing you and your family with great memories that last a lifetime.
    </p>
            </td>
        </tr>
    </table>
    <br>
    <br>

    <label> 
        Your name:<br>
    </label>
    <input type="text" name="customername" size='40' maxlength='50' required><br>

    <label>
        Your Email:<br>
    </label>
    <input type='email' name='emailaddress' size='20' maxlength='254' required><br>

    <label>
        Your phone number (example: 555-555-1234):<br>
    </label>
    <input name='telephone' type='tel' size=3>-<input type='tel' size=3>-<input type='tel' size=4><br>

    <label>
        What product are you interested in?<br>
    </label>
    <input type='radio' name='newshoot' value='new'>New Photo Shoot
    <input type='radio' name='existingshoot' value='existing'>Existing Photo Shoot
    <input type='radio' name='prints' value='prints'>Interested in prints

    <label>
        Street Adress:<br>
    </label>
    <input type="text" name="streetaddress" size='40' maxlength='50'><br>

    <label>
        City:<br>
    </label>
    <input type="text" name="city" size='40' maxlength='50'><br>

    <label>
        State:<br>
    </label>
            <input type="text" name="state" size='40' maxlength='50'><br>

    <label> 
        Zipcode:<br>
    </label>
            <input type="text" name="zipcode" size='40' maxlength='50'><br>

    <label>
        What country are you located in?<br>
    </label>
        <select>
            <option value="USA">United States</option>
            <option value="AFG">Afghanistan</option>

        </select><br>

    <label>
        Comments:<br>
    </label>

        <textarea name='customercomment' rows='5' cols='60' text-align='left' wrap='hard'>

在此处输入您的评论             

    <input type='submit' name='submit' value='Send' />
    <input type='reset' value='Reset'/>

</form>

这是我的php:

<?php

$email_to = "XXXXca@XXXXXto.com";

$email_subject = "Inquiry from: "($customername);    

$first_name = $_POST['customername'];

$email_from = $_POST['emailaddress'];

$telephone = $_POST['telephone'];

$newshoot = $_POST['newshoot'];

$existingshoot = $_POST['existingshoot'];

$prints = $_POST['prints']; 

$streetaddress = $_POST['streetaddress'];

$city = $_POST['city'];

$state = $_POST['state']; 

$zipcode = $_POST['zipcode'];

$comments = $_POST['customercomment'];




$email_message = "Form details below.\n\n".
"Customer Name: ($customername).\n Email: ($email_from).\n Telephone: ($telephone).\n New Shoot? ($newshoot).\n Existing Shoot? ($existingshoot).\n Prints? ($prints).\n Customer's address: ($streetaddress)($city)($state)($zipcode).\n Comments:($comments).\n";



if ($_POST['submit']) 
{
   mail($email_to, $email_subject,$email_message, $email_from) { 
        header('Location: index.html');
   }
}


?>

1 个答案:

答案 0 :(得分:-2)

你应该在文件中添加检查点,而不是看到它是否有效。

In [27]: modl.predict(X_test)
Out[27]: array([0, 0, 0, ..., 0, 0, 0])

In [28]: modl.predict_proba(X_test)
Out[28]: 
array([[ 0.6,  0.4],
       [ 0.7,  0.3],
       [ 1. ,  0. ],
       ..., 
       [ 1. ,  0. ],
       [ 0.9,  0.1],
       [ 0.8,  0.2]])
编辑:原谅我所有的朋友,我不想写这样的东西,但我必须这样做。我试图帮助他说他可能看到了一个空白页面  他拒绝显示错误。所以我写了这个答案,看看页面上是否有错误。他认为这是不正确的。但它帮助他看到了他的错误。但是,他没有感谢,他还命令我“更新你的帖子......”对不起,但我觉得礼貌并不难。