2017-08-13 102 views
-1

我已經在Bootstrap上構建了一個模型,並提供了我想要收集的信息字段。我想要的是,當「提交」按鈕被按下時,該信息會通過電子郵件發送給我。有沒有辦法做到這一點,而不需要把它變成一個rails應用程序?目前,我只是做了該指數的HTML & CSS代碼至今:如何獲取用戶通過電子郵件發送給您的模態信息

<div class="modal fade" id="contact" role="dialogue"> 
    <div class="modal-dialog"> 
     <div class="modal-content"> 
     <form class="form-horizontal"> 
      <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" 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" 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 rows="8" class="form-control"> </textarea> 
       </div> 
      </div> 

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

要自動提交表單,後端代碼,比如PHP,asp.net等是必需的。您可以使用'mailto'協議以新電子郵件自動填充用戶的默認電子郵件應用程序(不推薦)。 –

+0

有些人可能會說你還沒有嘗試過什麼,但你想完成什麼......至少嘗試一下,如果你被困住了,那麼這些傢伙會很樂意幫助你。不要只發布HTML和CSS,並要求社區編寫代碼。嘗試githut爲此;-) –

回答

0

你必須使用Google Apps Mail爲實現自己的目標。不需要像PHP,Python,Java,Ruby,Node.js等任何Backend服務器。

Check out this link瞭解更多詳情。

+0

謝謝 - 我用谷歌應用程序郵件攻擊此。儘管在文章中有10和11點,但無法使Java的'Ajax'腳本正常工作...... – Otis

0

您有幾個選項。首先你使用我覺得最簡單的php。下面是發送電子郵件一些示例PHP代碼:

<?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); 
?> 

你可以使用谷歌Apps郵件,但是如果你用表格和數據,你可能會使用一些後端的語言在未來像PHP的工作,所以這是值得的taking a look at now

讓我知道,如果您有任何其他疑問

相關問題