2014-01-17 63 views
1

Iam新的PHP編碼。我試圖從一個HTML page.It被重定向到我的「email.php」發送電子郵件,但沒有關係,不要發出email.My代碼是在這裏..PHP不發送電子郵件

<?php 

//if "email" is filled out, send email 

    //send email 
    $name = $_REQUEST['your-name'] ; 
    $email = $_REQUEST['your-email'] ; 
    $company= $_REQUEST['company'] ; 
    $website= $_REQUEST['website'] ; 
    $message=$name."<br>".$company."<br>".$website."<br>".$email; 
    $subject = 'Hai there' ; 
    $message = $_REQUEST['message'] ; 
    mail("[email protected]", $subject, 
    $message, "From:" . $email); 
    if(mail()){ 
    echo 'successfull'; 
    } 
    else{ 
    echo 'not successfull'; 
    } 


?> 

它總是顯示「未成功」。

回答

2

更換

if(mail()){ 

if(mail("[email protected]", $subject, $message, "From:" . $email)){ 
+1

很好,很快趕上.. –

+0

是我更換了,但它顯示'不成功' – Ansar

+0

我在真實服務器上試過它 – Ansar