Send emails with Azure functions + SendGrid biding.
- Azure account + subscription
- Connect to Azure portal.
- Go to create SendGrid Account from Azure portal (Add resource search SendGrid)
- Fill SendGrid Account creation form (select SendGrid free, and contacts informations ...), then deploy.
- Get API Key : Clic to Manage account link to be redirected to SendrGrid web console, then create new api key.
- Create new Azure functions application named SendGridAppFunc (Publish => Code, Stack => .Net Core, OS => Linux)
- Go to SendGridAppFunc settings, add new application parameter SendGridKey with praviously created API key as value
- Add new Azure HttpTrigger fonction named SendGridHttpFunc to SendGridAppFunc
- Update/replace function code with this snippet attached files
run.csx
andfunction.json
- Get the function URL from Azure portal
curl -X POST -H "Content-Type: application/json" \
-d '{ "OrderId": "78901", "CustomerName": "Mike P.O", "CustomerEmail": "[email protected]" }' \
https://sendgridappfunc.azurewebsites.net/api/[YourFunctionName]?code=xxxxxxxxxxxxxxxxxxxxxx