2016-01-05 22 views
0

我的郵箱PHP不改變htaccess的URL後工作,我是新來的PHP和htaccess的,也弄不清什麼是錯的。誰能幫忙?我的郵箱PHP不改變htaccess的URL後工作

的index.html

` <form method="post" name="sentMessage" id="contactForm" novalidate> 

mail.php

`<?php 
    // Check for empty fields 
    if(empty($_POST['name'])   || 
    empty($_POST['email'])  || 
    empty($_POST['phone'])  || 
    empty($_POST['message']) || 
    !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL)) 
    { 
    echo "No arguments Provided!"; 
    return false; 
    } 

    $name = $_POST['name']; 
    $email_address = $_POST['email']; 
    $phone = $_POST['phone']; 
    $message = $_POST['message']; 


    $to = '[email protected]'; 
    $email_subject = "Website Contact Form: $name"; 
    $email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email_address\n\nPhone: $phone\n\nMessage:\n$message"; 
    $headers = "From: [email protected]\n"; 
    $headers .= "Reply-To: $email_address"; 
    mail($to,$email_subject,$email_body,$headers); 
    return true;   
    ?> 

的.htaccess

`ErrorDocument 404 /filenotfound.html 

IndexIgnore * 

RewriteEngine On 


RewriteRule ^home index.html [NC,L] 

RewriteRule ^education about.html [NC,L] 

RewriteRule ^work project.html [NC,L] 

RewriteRule ^my_blog blog/blog.html [NC,L] 

RewriteRule ^about_me blog/about.html [NC,L] 

RewriteRule ^contact_me blog/contact.html [NC,L] 

感謝您的時間!

+0

當您刪除htaccess文件,會發生什麼?它工作嗎? –

回答

0

您的HTML表單不會發布到正確的文件。您應指定張貼到文件,在你的情況下,它會是mail.php

更改您的形式開始標籤

<form method="post" name="sentMessage" id="contactForm" action="mail.php" novalidate> 
+0

感謝您的回覆,但我嘗試過,仍然沒有工作是否有任何其他建議? –

+0

你能指定一些更多的信息嗎?什麼不工作?提交表單時會發生什麼? –

+0

當我嘗試通過我的聯繫表單發送郵件時,它說我的郵件服務器沒有響應。它工作得比較早,但當我改變我的htaccess的漂亮url後,我的聯繫人停止了工作。 jondmk.com是該網站。 –