Optiq
Optiq

Reputation: 3182

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. 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.

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. 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.

Upvotes: 0

Views: 50

Answers (1)

SuperVeetz
SuperVeetz

Reputation: 2176

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

<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":"[email protected]"}],
              "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.

Upvotes: 1

Related Questions