2015-10-06 59 views
0

我最近創建了一個網站並使用了Bootstrap的一個模板。我以前從未使用PHP,但看起來很容易遵循,我放棄了我的電子郵件地址,該網站目前正在運行,但我沒有通過嘗試幾次來收到電子郵件。我沒有收到來自我的Bootstrap模板的電子郵件php表格

這裏是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']; 

// Create the email and send the message 
$to = '[email protected]_invoke(com_object, function_name)'; // Add your email address inbetween the '' replacing [email protected] - This is where the form will send a message to. 
$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"; // This is the email address the generated message will be from. We recommend using something like [email protected] 
$headers .= "Reply-To: $email_address"; 
mail($to,$email_subject,$email_body,$headers); 
return true;    
?> 

這裏是HTML

<form name="sentMessage" id="contactForm" novalidate> 
    <div class="row"> 
     <div class="col-md-6"> 
      <div class="form-group"> 
       <input type="text" class="form-control" placeholder="Your Name *" id="name" required data-validation-required-message="Please enter your name."> 
       <p class="help-block text-danger"></p> 
      </div> 
      <div class="form-group"> 
       <input type="email" class="form-control" placeholder="Your Email *" id="email" required data-validation-required-message="Please enter your email address."> 
       <p class="help-block text-danger"></p> 
      </div> 
      <div class="form-group"> 
       <input type="tel" class="form-control" placeholder="Your Phone *" id="phone" required data-validation-required-message="Please enter your phone number."> 
       <p class="help-block text-danger"></p> 
      </div> 
     </div> 
     <div class="col-md-6"> 
      <div class="form-group"> 
       <textarea class="form-control" placeholder="Your Message *" id="message" required data-validation-required-message="Please enter a message."></textarea> 
       <p class="help-block text-danger"></p> 
      </div> 
     </div> 
     <div class="clearfix"></div> 
     <div class="col-lg-12 text-center"> 
      <div id="success"></div> 
      <button type="submit" class="btn btn-xl">Send Message</button> 
     </div> 
    </div> 
</form> 

預先感謝您!

+0

'_invoke(com_object,function_name)'應該不存在 – JimL

回答

相關問題