Web modules - server-side (backend) code
Accessing 3rd Party Services (using backend function)
Required for this example
The live demo of this example has an additional field for the your Sendgrid API Key. To run the live demo, paste your API Key into the Sendgrid API Key input field before clicking the Send Email button.
Links for this example
About this example
This example uses the SendGrid mail NodeJS package included in the Wix Package Manager to replace the sendGrid.js file in original SendGrid REST example. Using built-in code packages is easier and more convenient than having to write your own code.
As in the original example, we start by setting up a simple form with all of the fields necessary to send an email. When the user completes the form, the user clicks the Send button to request that the email be sent. The fields are checked for validity, and if everything is OK, the backend sendMail() function calls the SendGrid NodeJS send() function to send the email. A Lightbox then opens to notify the user of the email’s transmission status (success or failure).