Having a contact form on your website can make life easier for some of your clients. That's why in this post we'll show you how we made ours. And no, we won't use one of those SaaS form handling, potentially GDPR violating, privacy nightmare products. You will have the control of your data 🫵 and you will need to host the backend somewhere, like Digilol managed servers.
Here is the code for the contact form component. Omitted some irrelevant parts because it originally contained a vertical divider and alternative contact method logos.
Here we use Axios to make a POST request to our backend on submit. Also display a modal saying received on success and on failure the modal displays an additional button that launches an email client when clicked.
For the backend we will write a small Go program that launches an HTTP server to handle form requests and forward them to an email address.