2012-02-24 65 views
-1

我是一個nebie到php。我正在使用預生成html模板。我必須配置下面提到的表單。我改變了兩個值:php聯繫表格「發送郵件時出現了一些問題。」

$emailAdmin = "[email protected]", 
$urlWebSite = "mydomain.co.cc" 

但是當我點擊發送電子郵件。它給出了一個錯誤消息「發送郵件時出現了一些問題。」

<?php 
// ------------------------------------------------ ----------------------------------- 
// CONFIGURATION PARAMETERS OF GENERAL 
// ------------------------------------------------ ----------------------------------- 
$emailAdmin = "[email protected]", // email admin where notices are sent 
$urlWebSite = "mydomain.co.cc" // Website URL That Is added to the bottom of emails sent from contact form 

$headers_mail = "From: Company Name <[email protected]_domain.com> \ nReply-to: [email protected]_domain.com"; 
define ("OGGETTO_MAIL", "Contact from the site."); 

$str_contenuto_email = " 
You are receiving this email Because someone used the card of contacts on your website. 

Here the personal information we have That Contacted: 

-------------------------------------------------- ----------- 
Name and Surname: {name} 
E-mail: mail {} 
IP Address: {ip} 
-------------------------------------------------- ----------- 

This is the user's request: 

-------------------------------------------------- ----------- 
Message: {body} 
-------------------------------------------------- ----------- 

{url} "; 
?> 

我忘了提多了一個PHP文件,我還沒有配置,但它的存在,默認情況下,包含文件夾:

<?php 
include_once("config.php"); 
//------------------------------------------------------------------------------------------------ 
// RECUPERO IL VALORE DI TUTTI I DATI INVIATI DALL'UTENTE 
//------------------------------------------------------------------------------------------------ 
$str_ind_ip = $_SERVER['REMOTE_ADDR']; 
foreach ($_POST as $key=>$value) { 
    $$key = $value; 
} 
//------------------------------------------------------------------------------------------------ 
// PROCEDURA DI INVIO MAIL 
//------------------------------------- 
$str_oggetto   = OGGETTO_MAIL; 
$str_contenuto_email = str_replace("{name}",$visitor,$str_contenuto_email); 
$str_contenuto_email = str_replace("{mail}",$visitormail,$str_contenuto_email); 
$str_contenuto_email = str_replace("{ip}", $str_ind_ip,$str_contenuto_email); 
$str_contenuto_email = str_replace("{corpo}",$notes,$str_contenuto_email); 
$str_contenuto_email = str_replace("{url}",$urlWebSite,$str_contenuto_email); 
$headers    = $headers_mail; 

if ([email protected]($emailAdmin,$str_oggetto,$str_contenuto_email,$headers)) { 
    echo "<div class=\"error\">Have been some problems sending the email.</div>"; 
} else { 
    echo "<div class=\"success\">The email has been sent successfully.</div>"; 
} 
+1

*「發送郵件時出現了一些問題」*不是PHP錯誤,無法在您發佈的代碼中找到。這個問題目前沒有問題,但幾乎可以肯定地問過http://stackoverflow.com/questions/tagged/php+email – 2012-02-24 14:44:39

+0

你的mail()函數在哪裏?你定義了很多,但我看不到你發送它 - 看到http://php.net/manual/en/function.mail.php – Neysor 2012-02-24 14:45:38

+0

那麼你是正確的它不是PHP的錯誤,但它顯示在我的瀏覽器彈出消息。 – 2012-02-24 14:46:46

回答

-1

你錯過了mail() PHP函數

+1

他的問題集中在錯誤信息上。這應該是一個評論,要求更多的代碼B/C它顯然缺少大塊。 – 2012-02-24 14:45:49