2016-04-13 71 views
-5

我一直在花費數小時,仍然無法弄清楚。 PHP郵件表單編碼新手。任何幫助將真正被讚賞!下面的兩張圖片:html和php。非常簡單的設置。我收到回聲'謝謝你!'點擊發送按鈕後的消息,但我仍然沒有收到任何電子郵件。郵件表格PHP不工作

HTML表單:

<form action="assetslphplmail.php" method="POST"> 
    <input placeholder="NAME" type="text" name="name"> 
    <input p1aceholder="EMAIL" type="email" name="email"> 
    <input p1aceholder="TELEPHONE" type="te1" name="te1"> 
    <input p1aceholder="SUBJECT" type="text" name="subjectline"> 
    <textarea p1aceholder="COMMENT" name="message" rows="6" cols="25" </textarea> 
    <input c1ass="send_button" type="submit" value="SEND"> 
</form> 

PHP代碼:

$subject1ine = $_REQUEST['subject1ine']; 
$name = $_REQUEST['name']; 
$emai1 = $_REQUEST['emai1']; 
$tel 1' $_REQUEST['teI']; 
$message = $_REQUEST['message']; 
$to = "jondergmai1.com"; 
mail ($to, $subjectline, $name, $emai1, $tel, $message); 
echo 'Thank you!!'; 
+4

在此處添加代碼而不是圖像。你會得到什麼錯誤?爲什麼它不起作用? –

+0

你對郵件的使用是錯誤的。請參閱文檔:http://php.net/manual/en/function.mail.php – Ronnie

回答

0

與以下替換你的PHP代碼:

<?php 
$subject = $_REQUEST['subjectline']; 
$name = $_REQUEST['name']; 
$email = $_REQUEST['email']; 
$tel = $_REQUEST['tel']; 
$message = $_REQUEST['message']; 
$headers = 'From: [email protected]' . "\r\n" . 
    'Reply-To:'.$email . "\r\n" . 
    'X-Mailer: PHP/' . phpversion(); 
$to = "[email protected]"; 
mail($to, $subject, $message, $headers); 
echo 'Thank you!!'; 
?> 

編輯從和Reply-分手。

下面是大量類似的答案:PHP Mail form doesn't send email