An Azure Function that allows you to power a "Contact Form" or a "Feedback Form" on your website or app. You will get the repsonses in your email and you can just reply-back to the user instantly.
Currently, this I am using SendGrid as an relay for sending emails. Their free-tier plan is really good. But if you want to use your email account, I would suggest using python's smtplib, it should be really easy to setup.
I will try to make same thing for AWS Lambda and without SendGrid.
nameUser inputted name from your contact formfrom_emailUser inputted email from your contact formto_emailEmail you want to deliver the responses tophoneUser inputted phone number from your contact formsubjectSubject you want to set for your responses email
You can check a sample request request.http
- Install the recommended extensions from
extensions.json. You can also use microsoft docs and install all the prequisites. - VS Code should tell you to create a virtual env. You can also run this
python3 -m venv .venvto create.venvin root directory of this project - Create a
local.settings.jsonfile in root directory of this project and add your Sendgrid API key. Fill in required fields thelocal.settings.json.example - Start debugging or F5 and you should have this running on http://localhost:7071/api/EmailTheForm
- To test use the
request.httpand modify the values or check Demo section
Once you have the development environnement running. You can test a contact form running locally with a provided create-react-app in example directory made using react-bootstrap. Checkout react app template for more commands.
- Open a new terminal window
cd example - Install all the dependencies
npm install - Need to change
to_emailfield inContactForm.jsand use your email to try this out. - Run the app
npm start - You should have this running on http://localhost:3000
NOTE: Make sure that the function is running on http://localhost:7071/api/EmailTheForm
- Follow the steps given in Azure Docs to deploy your function from VS Code.
- Now you need to give your Sendgrid API key to deployed Azure Function to run. Go to
Configurationof azure function (use Azure Docs to find this) and add a new application setting:- name:
SENDGRID_API_KEY - value:
YOUR_SENDGRID_API_KEY
- name:
- Check out Azure Docs to enable CORS and allow your application to use this service.