Azure Serverless Contact Form (SendGrid v3 API)
A simple serverless application that sends an email to a single user by way of an Azure Function connecting to SendGrid v3 API.
One of the reasons I created a separate repo based on Mike Pfeiffer's original source was the changes both in the SendGrid API and some underpinnings in Azure Functions for loading the necessary extensions.
- 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_API_KEY that contains your SendGrid API key.
- Deploy the Contact function 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 17 in the function.json file to include your desired destination email address before you deploy.
- The webdocs HTML and JS files are heavily commented for reference. If you look at my portfolio site repo you'll see that the HTML is dropped in-line into the contact.md file and the JS is included in the template path and added to the config.toml . You must first update line 12 in the contact.js file with your function URL before you upload.
- The CSS animation uses the loading.css library.
- I'm in the process of implementing Skeleton CSS and found Skeleton-alerts in the process. That's how the confirmation is marked up.
- The SVG comes from the Microsoft Icon library.
Houston Haynes @HoustonHaynes
and borrows very heavily from the work of Mike Pfeiffer @mike_pfeiffer
This project is licensed under the Apache License 2.0