2013-09-27 55 views
-1

我很困擾這個問題,過去我用PHP做郵件表單時工作得很好,但我的大腦並沒有在這個工作。任何想法都會非常有幫助。PHP郵件格式故障排除

<?php 
if(isset($_POST['email'])) { 


$email_to = "[email protected]"; 
$email_subject = "eKoWeld Feedback"; 

$email_message = "Form details below.\n\n"; 

function clean_string($string) { 
    $bad = array("content-type","bcc:","to:","cc:","href"); 
    return str_replace($bad,"",$string); 
} 

$company_name = $_POST['company_name']; 
$contact_name = $_POST['contact_name']; 
$industry = $_POST['industry']; 
$do = $_POST['do']; 
$material = $_POST['material']; 
$TIG_MIG = $_POST['TIG_MIG']; 
$Instructions = $_POST['Instructions']; 
$easy = $_POST['easy']; 
$Before = $_POST['Before']; 
$After = $_POST['After']; 
$Savings = $_POST['Savings']; 
$recommend = $_POST['recommend']; 
$another = $_POST['another']; 
$testimonial = $_POST['testimonial']; 




?> 
Thank you for leaving feedback. 
<?php 
} 
?> 
+0

哪裏是你的郵件功能 –

+0

你需要告訴我們的問題是什麼,你正在經歷。 – Andrew

+0

我遇到的問題是,當我點擊提交時,而不是使用PHP函數,它會進入PHP頁面,如果這是有道理的。 – user2822648

回答

0

PHP Mail

<?php 
$to  = '[email protected]'; 
$subject = 'the subject'; 
$message = 'hello'; 
$headers = 'From: [email protected]' . "\r\n" . 
    'Reply-To: [email protected]' . "\r\n" . 
    'X-Mailer: PHP/' . phpversion(); 

mail($to, $subject, $message, $headers); 
?> 

你必須忘記添加郵件功能

<?php 
if(isset($_POST['email'])) { 


$email_to = "[email protected]"; 
$email_subject = "eKoWeld Feedback"; 

$email_message = "Form details below.\n\n"; 

function clean_string($string) { 
    $bad = array("content-type","bcc:","to:","cc:","href"); 
    return str_replace($bad,"",$string); 
} 

$company_name = $_POST['company_name']; 
$contact_name = $_POST['contact_name']; 
$industry = $_POST['industry']; 
$do = $_POST['do']; 
$material = $_POST['material']; 
$TIG_MIG = $_POST['TIG_MIG']; 
$Instructions = $_POST['Instructions']; 
$easy = $_POST['easy']; 
$Before = $_POST['Before']; 
$After = $_POST['After']; 
$Savings = $_POST['Savings']; 
$recommend = $_POST['recommend']; 
$another = $_POST['another']; 
$testimonial = $_POST['testimonial']; 

mail($to, $subject, $message, $headers); // add this line with your variables 


?> 
+0

我遇到的問題是,當我點擊提交時,而不是使用PHP函數,它會進入PHP頁面,如果這是有道理的。 – user2822648