Simple serverless application that sends an email using Azure Functions and SendGrid.
This demo application contains a static HTML contact page and a JavaScript-based function that uses the Azure Functions Runtime 2.0. The HTML page can be served from Azure Storage. When users fill out and submit the form, it invokes the function and sends the form details via email using SendGrid.
Eventually, I will include deployment automation instructions for this project. For now, you can follow these high-level steps to manually deploy this application to Azure.
- Create an Azure Function App using the steps outlined in this guide.
- Create an Azure Storage account and enable static website hosting.
- Create a SendGrid Account in the Azure Portal and create a SendGrid API key in the SendGrid console.
- Create an App Setting entry in your Function App called SendGrid that contains your SendGrid API key.
- Deploy the ContactFormAPI in this repo to your Function App. You can do this easily with Visual Studio (VS) Code using the steps outlined in Deploy to Azure using Azure Functions. Make sure you update line 23 in the function.json file to include your desired destination email address before you deploy.
- Upload the index.html file from the www folder of this repo into the $www container in your static website enabled storage account. You must first update line 67 in the index.html file with your function URL before you upload.
Mike Pfeiffer @mike_pfeiffer
1.0.0
This project is licensed under the Apache License 2.0