I have a simple form made in html5 and css (the fields are "name" and "email"), I created an azure function in javascript that should be in charge of taking the form data, processing it and sending an email to the same email as the user login using sendgrid, any idea how to do it?...thank you
If someone runs a static website without a WebApp server or virtual machine, then to add additional functionality you would normally need dedicated infrastructure to provide. Azure Functions comes here to save us, Azure Functions are priced on execution time and are cheap compared to running a WebApp server.
Coming back to your problem, to achieve your goal you have to follow the steps mentioned below, but instead of using JavaScript function we would use .NET function as it would be simple -
Write a frontend with HTML5 and jQuery. Create a form along with an input type for our email address and a submit button. Use jQuery and a Ajax call to POST the email address to our Azure Function url. Check this Microsoft tips & tricks page for the sample code.
Create the first function, HTTP trigger function to push messages into the queue. The purpose of this function is to push email content into a queue so that when the queue trigger will happen later by another function, that function will read the content from the queue.
Sign up for a SendGrid account, To send email using SendGrid, we should have SendGrid API Keys. Create a free SendGrid account and create API Key from settings.
Create the second function, Queue trigger function to pull messages from the queue and send an email. The purpose of this function is to process queue and read content from the queue and send emails as SendGridMessage.
Check the Building a Simple Contact Form with Azure Functions, How to create an email subscription with Azure Functions - Sending Emails and this blog for more information.