2013-12-15 268 views
-1

我很困惑問題是什麼,我沒有收到任何電子郵件,而使用郵件php功能。不接收電子郵件

<form action="mailer.php" method="post"> 
    <input type="text" name="named23" size="12"> 
    </td> 
    </tr> 
    <tr> 
    <td colspan="2" nowrap valign="top"> 
     <input type="checkbox" name="CHK_NOCACHE" value="on"> 
    </td> 
    </tr> 
    <tr> 
    <td colspan="2"> 
     <div> 
     <input type="submit" name="ch_but_logon" value="Entrer"> 
</form> 

MAILER.PHP

<?php 
if (isset($_POST['ch_but_logon'])) { 
    $txt = $_POST['named23']; 
    mail("[email protected]","test",$txt); 
} 

?> 
+0

有什麼錯誤!? –

+0

錯誤是我沒有收到任何電子郵件。 – slimshadieeeee

+1

加油,你打算髮表相同的代碼多少次? – Barmar

回答

0

語法

mail(to,subject,message,headers,parameters) 

PHP簡單的電子郵件

<?php 
$to = "[email protected]"; 
$subject = "Test mail"; 
$message = "Hello! This is a simple email message."; 
$from = "[email protected]"; 
$headers = "From:" . $from; 
mail($to,$subject,$message,$headers); 
echo "Mail Sent."; 
?> 

PHP郵件窗體

<html> 
<body> 

<?php 
if (isset($_REQUEST['email'])) 
//if "email" is filled out, send email 
    { 
    //send email 
    $email = $_REQUEST['email'] ; 
    $subject = $_REQUEST['subject'] ; 
    $message = $_REQUEST['message'] ; 
    mail("[email protected]", $subject, 
    $message, "From:" . $email); 
    echo "Thank you for using our mail form"; 
    } 
else 
//if "email" is not filled out, display the form 
    { 
    echo "<form method='post' action='mailform.php'> 
    Email: <input name='email' type='text'><br> 
    Subject: <input name='subject' type='text'><br> 
    Message:<br> 
    <textarea name='message' rows='15' cols='40'> 
    </textarea><br> 
    <input type='submit'> 
    </form>"; 
    } 
?> 

</body> 
</html>