2010-08-12 32 views
2

我想在widows上使用php聯繫表單asp.net託管包,php已啓用,但仍然是我的表單不發送電子郵件,它正在引導到error.html頁面.... ..在Windows上的PHP聯繫窗體託管錯誤

這裏是代碼

<?php 

$EmailFrom = "anksaltlamps.com"; 
$EmailTo = "[email protected]"; 
$Subject = "Website Query"; 
$Name = "Not Specified"; 
$Tel= "Not Specified"; 
$City= "Not Specified"; 
$Country= "Not Specified"; 
$Other= "Not Specified"; 
$Address= "Not Specified"; 
$Message= "Not Specified"; 
$State= "Not Specified"; 


$Name = Trim(stripslashes($_POST['Name'])); 
$Tel = Trim(stripslashes($_POST['Tel'])); 
$Email = Trim(stripslashes($_POST['Email'])); 
$City = Trim(stripslashes($_POST['City'])); 
$State = Trim(stripslashes($_POST['State'])); 
$Country = Trim(stripslashes($_POST['Country'])); 
$Other = Trim(stripslashes($_POST['Other'])); 
$Address = Trim(stripslashes($_POST['Address'])); 
$Message = Trim(stripslashes($_POST['Message'])); 

// prepare email body text 
$Body = ""; 
$Body .= "Name: "; 
$Body .= $Name; 
$Body .= "\n"; 

$Body .= "Tel: "; 
$Body .= $Tel; 
$Body .= "\n"; 

$Body .= "Email: "; 
$Body .= $Email; 
$Body .= "\n"; 

$Body .= "Address: "; 
$Body .= $Address; 
$Body .= "\n"; 

$Body .= "City: "; 
$Body .= $City; 
$Body .= "\n"; 

$Body .= "State/Province: "; 
$Body .= $State; 
$Body .= "\n"; 

$Body .= "Country: "; 
$Body .= $Country; 
$Body .= "\n"; 

$Body .= "Other Country: "; 
$Body .= $Other; 
$Body .= "\n"; 

$Body .= "Message: "; 
$Body .= $Message; 
$Body .= "\n"; 

ini_set('sendmail_from', '[email protected]'); 
// send email 
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); 

// redirect to success page 
if ($success){ 
    print "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.html\">"; 
} 
else{ 
    print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">"; 
} 
?> 

,或者你通過這個鏈接

link text

+1

什麼是php.ini中的SMTP和smtp_port郵件設置 – 2010-08-12 13:51:30

+0

您是否在php.ini中編輯郵件配置? – 2010-08-12 13:52:05

回答

0

Read this在線檢查。 這可能是由於您在php.ini中的郵件設置。

+0

如何在我的主機區域獲得php.ini文件..... – 2010-08-12 19:59:17

+1

如果您使用Wamp,然後查看'C:\ wamp',否則請執行磁盤搜索'php.ini'。 如果您在共享主機,然後聯繫您的託管服務提供商,但它沒有意義,因爲大多數主機已啓用郵件()。 – Youssef 2010-08-13 13:29:55

+0

託管服務提供商說,他們正在使用NET_smtp ..我不知道我應該如何提供這個.... cgi bin未啓用服務器,但php最新版本已啓用.... 在我的另一個託管公司,在windows環境下使用這種形式沒有任何問題 – 2010-08-13 16:25:59

相關問題