2016-12-14 139 views
0

我一直在我的網站上使用formspree。一切工作都很好,然後表單信息不發送電子郵件。當表單被髮送出去時,我看到名稱和消息,但電子郵件只是沒有註冊。我看着簡碼,並沒有看到任何事情。有沒有人在這裏看到這個問題?我Formspree聯繫表格不發送電子郵件信息

我也有我的「我正在尋找報價」的措辭重疊我的複選框在大多數瀏覽器。我放了一個p並拿出來,但我認爲這可能會弄亂代碼。還有什麼想法呢?

這裏的HTML:

   <form role="form" id="formspree" method="post"> 

        <div class="form-group"> 
         <label class="sr-only" for="contact-name">Your Name</label> 
         <input type="text" name="name" placeholder="Your Name" class="contact-email form-control" id="contact-email"> 
        </div> 
        <input type="text" name="_gotcha" style="display:none"> 
        <div class="form-group"> 
         <label class="sr-only" for="contact-email">Email</label> 
         <input type="text" name="email" placeholder="Email" class="contact-email form-control" id="contact-email"> 
        </div> 
        <div class="form-group"> 
         <label class="sr-only" for="contact-message">Message</label> 
         <textarea name="message" placeholder="Message" class="contact-message form-control" id="contact-message" style="height: 168px;width:100%;"></textarea> 
        </div> 
        <div class="row"> 
         <div class="col-sm-6" style=" 
text-align: right; 
padding-right: 15px; 

          <div class="form-group"><label class="checkbox-inline"><input id="looking_for_quote" type="checkbox" value="quote">I'm Looking For A Quote</label> 
          </div> 
         </div> 
         <div class="col-sm-6"> 

          <button type="submit" class="btn btn-lg"> Send Message</button> 
         </div> 
        </div> 
       </form> 

這裏是腳本:

$(document).ready(function() { 

    // process the form 
    $('form[method=post]').submit(function(event) { 
     var email = "[email protected]"; 
     if ($('#looking_for_quote').is(':checked')) { 
       email = "[email protected]"; 
     } 

     $.ajax({ 
      url: "https://formspree.io/" + email, 
      method: "POST", 
      data: { 
       message: $('textarea').val(), 
       from: $('input[name=name]').val(), 
       _reply: $('input[type=email]').val() 
      }, 
      dataType: "json", 
      success: function() { 
       alert("Thanks! We'll get back to you soon."); 
      } 
     }); 

     // stop the form from submitting the normal way and refreshing the page 
     event.preventDefault(); 
    }); 

}); 
+0

我想明白了..我改變了_reply:$('input [type = email]')。 val()給email:$('input [name = email]')。val() –

回答

0

我想通了,我認爲。我_reply改變:$( '輸入[類型=電子郵件]' ).val()發送郵件:$('input [name = email]')。val()