Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.
saihajPublic archive

About

An Azure Function that allows you to power a "Contact Form" on your website or app. You will get the repsonses in your email and you can just reply-back to the user instantly.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Email The Form

CodeFactor     

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.

Required Values

  • name User inputted name from your contact form
  • from_email User inputted email from your contact form
  • to_email Email you want to deliver the responses to
  • phone User inputted phone number from your contact form
  • subject Subject you want to set for your responses email

You can check a sample request request.http

Development

  • 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 .venv to create .venv in root directory of this project
  • Create a local.settings.json file in root directory of this project and add your Sendgrid API key. Fill in required fields the local.settings.json.example
  • Start debugging or F5 and you should have this running on http://localhost:7071/api/EmailTheForm
  • To test use the request.http and modify the values or check Demo section

Demo

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_email field in ContactForm.js and 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

Production Deployment

  • 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 Configuration of azure function (use Azure Docs to find this) and add a new application setting:
    • name: SENDGRID_API_KEY
    • value: YOUR_SENDGRID_API_KEY
  • Check out Azure Docs to enable CORS and allow your application to use this service.

About

An Azure Function that allows you to power a "Contact Form" on your website or app. You will get the repsonses in your email and you can just reply-back to the user instantly.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages