Create forms on your site and send the submissions to an email address or integrate with your own workflows.
To create a form:
- If you haven't already, create an inbox and connect it to your site.
- Add an HTML form to a page
- Set the
method
attribute to post - Set the
action
to where the visitor is redirected after the form submission - Add an
input
element with the nameinbox_key
and set itsvalue
attribute to the key you gave your inbox. If you don't include this input the form will be sent to the default inbox connected to your site. - Add form fields with
name
attributes to collect data from visitors
CloudCannon sends named form data to email addresses of your choosing. Alternatively, use a hook to integrate with services like Zapier or IFTTT.
Special Fields#
Use these fields to customize the email CloudCannon sends through the form. The fields can be hidden or visible, depending on your requirements.
_replyto
- the value used for the Reply-To header in the email. Use this to ensure clients reply to the visitor rather than a default CloudCannon address.
_subject
- the subject of the email.
_gotcha
- honeypot field for preventing untargeted spam. CloudCannon does not send the email if this field has a value. Hide it with CSS to prevent visitors filling it out.
For better spam prevention try using Google reCAPTCHA or hCaptcha.
Submitting with AJAX#
Submitting a form with JavaScript saves a page load after sending a message, providing a seamless experience. Viewers without JavaScript enabled will fall back to the normal flow.
To submit your form with JavaScript:
- Build and test your form
- Override the submit event on your form
- Change the page to notify your viewers the message was sent
Start with this JavaScript snippet and adapt it for your site: