简体   繁体   English

我可以创建一个HTML5表单,将表单直接发送答案到我的电子邮件,而不必使用PHP或SQL

[英]can I create an HTML5 form that sends answers directly to my email without having to use PHP or SQL

I made a 30 page questionnaire in Indesign and I need to apply some show/hide functions to it but Indesign only allows you to manipulate things on the same page as the function when I need to manipulate things all through the questionnaire. 我在Indesign中制作了一个30页的问卷,我需要对其应用一些显示/隐藏功能,但是当我需要通过问卷对所有内容进行操作时,Indesign仅允许您在与该功能相同的页面上进行操作。 I tried Acrobat Pro but that keeps crashing in form edit mode and NOBODY knows why this happens, I looked it up and seen other people have this issue and nobody has been able to help. 我尝试了Acrobat Pro,但是在表单编辑模式下一直崩溃,并且NOBODY知道为什么会发生这种情况,我查了一下,发现其他人遇到了这个问题,没有人能够提供帮助。

So my next best bet is to make an HTML5 form and it's going to be enough of a hassle for me personally to get the javascript working right with showing and hiding the appropriate fields so before I embark upon this journey I want to know if it's possible for the answers to be compiled and sent to my email without having to wrap my head around php and sql too. 因此,我的下一个最佳选择是制作一个HTML5表单,对我个人而言,让javascript正确显示和隐藏适当的字段就足够了,所以在我踏上这一旅程之前,我想知道是否有可能以便将答案编译并发送到我的电子邮件中,而不必将我的头放在php和sql周围。 I've tried that before with building my own website which also NEVER happened because I just can't afford to spend as much time as I'd need to in order to figure it all out. 在构建自己的网站之前,我曾尝试过这样做,但是从来没有发生过,因为我只是花不起足够的时间来解决所有问题。

Here's a simple example but you'll need to goto their website at Mandrill and sign up for their free service and get your own API Key 这是一个简单的示例,但是您需要转到他们在Mandrill的网站并注册他们的免费服务并获得自己的API Key

<body>

    <form class="form-inline" onsubmit="sendTheMail()">
      <div class="input-group">
        <input type="text" id="contact-name" placeholder="Name" name="contact-name">
        <input type="text" id="contact-phone" placeholder="Phone" name="contact-phone">
        <input type="text" id="contact-email" placeholder="Email" name="contact-email">
        <input type="text" id="contact-message" placeholder="Message" name="contact-message">
      </div>
      <div class="input-group">
        <button class="btn btn-success" type="submit">Send</button>
      </div>
    </form>

  <script src="vendors/mandrill.js"></script>
    <script>
      var sendTheMail = function() {

      // create a new instance of the Mandrill class with your API key
      var m = new mandrill.Mandrill('goto/their/website/to/get/your/own/free/key')
      // Collect Inputs
      var name = document.getElementById('contact-name').value;
      var phone = document.getElementById('contact-phone').value;
      var email = document.getElementById('contact-email').value;
      var message = document.getElementById('contact-message').value;

      var emailBody = "From: " + name + "<br><br>" + "Phone Number: " + phone + "<br><br>" + message;

      var params = {

          "message": {
              "from_email":email,
              "to":[{"email":"yourEmail@gmail.com"}],
              "subject": "Form Submission from your website",
              "html": emailBody
          }
      };

      m.messages.send(params);

    };
    </script>

</body>

As long as you don't send thousands of emails a month, then it's free. 只要您每月不发送数千封电子邮件,那么它是免费的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM