#Example #Sendgrid #Email #WebModules #ServerSide #backend #3rdPartyServices #PackageManager #ExternalCode #NPM Demonstrates Wix Package Manager SendGrid email API web services SendGrid mail NodeJS package Web modules - server-side (backend) code Accessing 3rd Party Services (using backend function) Calling Server-side Code from the Front-end with Web Modules Required for this example
In order to run this example in the editor, you will need a Sendgrid account to supply your own Sendgrid API key . Paste the key in the appropriate line in the sendEmail.jsw file.
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 View the "Live" example in a browser page Open the Example template in the Wix Editor 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).
For more information, see the Wix Package Manager and the Sendgrid API documentation .