How our Contact Form Works:
Our form is a very simple interface to an API we setup on AWS.
-
We have an AWS API Gateway that our contact form will POST the
form contents to.
-
The API uses the REST protocol and if the POST request has all
the required data, it will forward the data received within the
AWS Cloud to an AWS Lambda function.
-
An AWS Lambda Function is Amazon's serverless technology. You
pay for the amount of time a piece of code takes to execute.
They have a very generous free tier limit that should meet our
needs without incurring costs.
-
The Lambda creates a very small server on AWS using AWS Linux
and applies a layer with Nodemailer. It then executes a small
piece of Javascript code that will import Nodemailer, format the
data received into an email, and sends that email to the Coder
Dojo champion and the email address entered.
-
This should all take approximately one and a half seconds given
128Mb of memory. If it takes more than 5 seconds it will fail
and no emails will be sent. This is yet to happen and should
appear in our logs if it does.
-
We use an Outlook.com mailbox specifically for the contact us
form and our Lambda function connects to it over SMTP using
Nodemailer for sending the email.
-
Once the email is sent, the SMTP response is passed back from
the Lambda function to the API Gateway.
-
The API Gateway will return a response and the connection should
be closed.
-
Everything processed by the Lambda function is destroyed, the
only copy of the form data should be the email sent to our
champion and the email sent to the sent to the address entered
in the form.
-
We will have a log of the processing of the Lambda function and
the API gateway HTTP log of the connection to our API.
Things to fix:
-
The form lacks validation. This means we are not checking the
data entered is valid and if an incorrect email address is
entered, the notification will not be sent.
- Responses and errors handling not right.