Skip to content

Instantly share code, notes, and snippets.

@vfulco
Forked from matthiaseisen/contact.html
Created May 27, 2013 16:38
Show Gist options
  • Save vfulco/5658001 to your computer and use it in GitHub Desktop.
Save vfulco/5658001 to your computer and use it in GitHub Desktop.
<!-- You are probably already familiar with the possibility of hosting static websites on Amazon S3.
If not you should read this great tutorial by Chad Thompson: http://chadthompson.me/2013/05/06/static-web-hosting-with-amazon-s3/.
One common problem is that while being static your website still needs a contact form.
Here's a solution for this problem using Newman API (http://www.newmanapi.com). -->
<html>
<body>
<!-- First we set the 'action' attribute of <form> to point to Newman API -->
<form method="post" action="http://submit.newmanapi.com/" >
<!-- Now we create our input elements as we would in any other form -->
Email*: <input type="text" name="email" /><br />
Subject: <input type="text" name="subject" /><br />
Message*:<br />
<textarea name="message" rows="10" cols="35" ></textarea><br />
<br />
<input type="submit" value="submit" />
<!-- There's some more configurating to do... -->
<!-- We need to tell Newman API what input fields we want to have sent to us -->
<input type="hidden" name="newman_fields" value="email,subject,message" />
<!-- Also, We want 'email' and 'message' to be required fields -->
<input type="hidden" name="newman_required" value="email,message" />
<!-- And of course we must not forget to include our API key -->
<input type="hidden" name="newman_api_key" value="YOUR API KEY" />
<!-- Finally, we have prepared a 'Thank you' page for users to visit after submitting the form -->
<input type="hidden" name="newman_thanks_url" value="http://www.example.com/thanks/" />
<!-- If something goes wrong we want to have users sent back to our contact form -->
<input type="hidden" name="newman_oops_url" value="http://www.example.com/contact/" />
<input type="hidden" name="newman_error_url" value="http://www.example.com/contact/" />
<!-- That's it! Now our shiny new contact form is ready to be uploaded. -->
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment