2017-08-14 45 views
0

我一直在通過此鏈接工作https://www.npmjs.com/package/html-form-send-email-via-google-script-without-serverhttps://github.com/dwyl/html-form-send-email-via-google-script-without-server但不能通過點10 & 11 - 獲取「感謝您的消息」警報而不是JSON響應/警報。使用Google Apps郵件從靜態HTML表單發送電子郵件

我已經與Google在線交談過,他們現在已經在這裏提到我。我使用bootstrap - 我的代碼在下面,任何想法都會很棒。

<section class="test"> 
<a name="index"></a> 
    <div class="container"> 
    <div class="row index_section"> 
     <div class="col-md-10 col-md-push-1"> 
     <h2 class="index_h2">The RE Ledger Foundation is a consortium of east coast real estate and financial services executives with the purpose of exploring the applications and advantages of harnessing a blockchain backed peer-to-peer network.</h2> 
     <p><a class="btn btn-secondary btn-lg index_button" role="button" href="#contact" data-toggle="modal" >Contact Us</a></p> 
     </div> 
    </div> 
    </div> 

</section> 
<div class="modal fade" id="contact" role="dialogue"> 
    <div class="modal-dialog"> 
     <div class="modal-content"> 
     <form class="form-horizontal" method="POST" action="https://script.google.com/a/macros/headlandholdings.co/s/AKfycbyA1uVrYJK3dowguYNKo65hPfQKLGCFh8_865dFMhXzfE__Io8/exec"> 
      <div class="modal-header"> 
      <h4>Contact RE Ledger</h4> 
      </div> 
      <div class="modal-body"> 

      <div class="form-group"><!-- For every row --> 
       <label for="Contact-name" class="col-lg-2 control-label"> Name: </label> 
       <div class="col-lg-10"> 

       <input type="text" class="form-control" id="contact-name" name="contact-name" placeholder="Please put your full name"> 
       </div> 
      </div> 

      <div class="form-group"><!-- For every row --> 
       <label for="contact-email" class="col-lg-2 control-label"> Email: </label> 
       <div class="col-lg-10"> 

       <input type="email" class="form-control" id="contact-email" name="contact-email" placeholder="[email protected]"> 
       </div> 
      </div> 

      <div class="form-group"><!-- For every row --> 
       <label for="contact-message" class="col-lg-2 control-label"> Message: </label> 
       <div class="col-lg-10"> 

       <textarea type= "text" name="message" rows="8" class="form-control"> </textarea> 
       </div> 
      </div> 

      <div class="modal-footer"> 
       <a href="#index" class="btn btn-default" data-dismiss="modal">Close it</a> 
       <button class="btn btn-primary" type="submit"> Submit</button> 
      </div> 
      <div style="display:none;" id="thankyou_message"> 
       <h2><em>Thanks</em> for contacting us!</h2> 
      </div> 
      </div> 
     </form> 
     </div> 
    </div> 
    </div> 

</div><!-- /.container --> 

<!-- Included so that when you complete a contact request you get a message --> 
<script data-cfasync="false" type="text/javascript" 
src="https://cdn.rawgit.com/dwyl/html-form-send-email-via-google-script-without-server/master/form-submission-handler.js"></script> 
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> 
<!-- Include all compiled plugins (below), or include individual files as needed --> 
<script src="js/bootstrap.js"></script> 

回答

0
<form class="form-horizontal" method="POST" action="https://script.google.com/a/macros/headlandholdings.co/s/AKfycbyA1uVrYJK3dowguYNKo65hPfQKLGCFh8_865dFMhXzfE__Io8/exec"> 

在上面的代碼行中,action=應該是指由谷歌提供的鏈接。在您提供的github鏈接的第5點,您應該在deploy web app之後獲得鏈接。使用該鏈接而不是示例代碼。

給你的提示:只有你理解的複製代碼。

+0

嗨 - 這是正確生成的鏈接 - 是什麼讓你覺得是不是?我認爲事實消息正在轉發到電子郵件帳戶確認此 – Otis

+0

@Otis因爲如果您不是該github帖子的所有者並共享SAME谷歌帳戶。您將無法生成相同的鏈接。當我按照步驟進行確認時,我沒有生成相同的鏈接。當您部署爲Web應用程序時,您正在部署您的OWN Web應用程序,從而生成您的OWN鏈接。 – Tim1234

+0

這就是我所做的鏈接正在生成屬於我。這不同於https://cloud.githubusercontent.com/assets/194400/10560470/e2d7fcb6-7503-11e5-9d9a-3771423e51fa.png – Otis

0

好吧 - 這已經過了很長時間,但我知道了。首先,在頂部使用Github鏈接,而不是另一個 - 它不容易遵循。

與JSON/Ajax的問題​​是,我試圖在示例中使用不同的模式到谷歌表單。重要的是,id =「gforms」這一行會插入您的個人生成的電子郵件地址鏈接的地方。

然後,我從github中獲取索引示例,並有條不紊地移動所有名稱數據。這是乏味的,但它的工作

<div class="modal fade" id="contact" role="dialogue"> 
    <div class="modal-dialog"> 
     <div class="modal-content"> 
     <form id="gform" class="form-horizontal" method="POST" action="--- YOUR LINK HERE ---"> 

      <div class="modal-header"> 
      <h4>Contact RE Ledger</h4> 
      </div> 

      <div class="modal-body"> 




      <fieldset class="form-group"> 
       <label for="name" class="col-lg-2 control-label">Name: </label> 
       <div class="col-lg-10"> 
       <input type="text" class="form-control" id="name" name="name" placeholder="Please put your full name" /> 
      </fieldset> 

      <fieldset class="form-group"> 
       <label for="email" class="col-lg-2 control-label">Email: </label> 
       <div class="col-lg-10"> 
       <input type="email" class="form-control" id="email" name="email" value="" required placeholder="[email protected]"/> 
      </fieldset> 

      <fieldset class="form-group"> 
       <label for="message" class="col-lg-2 control-label">Message: </label> 
       <div class="col-lg-10"> 
       <textarea type= "text" id="message" name="message" rows="8" class="form-control"></textarea> 
      </fieldset> 

      <div class="modal-footer"> 
       <a href="#index" class="btn btn-default" data-dismiss="modal">Close it</a> 
       <button class="btn btn-primary" type="submit"> Submit</button> 
      </div> 


      </div> 
     </form> 
     <!-- Customise the Thankyou Message People See when they submit the form: --> 

     <div style="display:none;" id="thankyou_message"> 
      <h2 class='col-lg-10 model_message'> Thanks for your message - We will get back to you soon</h2> 
     </div> 

     </div> 
    </div> 
    </div> 






</div><!-- /.container --> 

<!-- Included so that when you complete a contact request you get a message --> 
<script data-cfasync="false" type="text/javascript" 
src="https://cdn.rawgit.com/dwyl/html-form-send-email-via-google-script-without-server/master/form-submission-handler.js"></script> 
相關問題