Getting an alert email when a form is submitted.

Does all of the code for this tutorial go on the ‘page’ code? I have set up my Sendgrid account, and entered the API key, but it’s still not firing.
https://support.wix.com/…/wix-code-tutorial-sending-an-emai…
Also, when I publish the page, and then visit the page, when (in chrome) I turn on developer view, I cannot see the code I added. Thank you.

@Brian Murray

No it doesn’t all go in the page code.

As it states on the tutorial page, you will need to add two new files into the Backend on the site structure in your Wix editor:
***Next, in two backend files, we create two functions to call our 3rd party email delivery service. ***

To do this simply go to your site structure on the far left:
https://support.wix.com/en/article/wix-code-working-with-the-site-structure-sidebar

Click on Backend and create a new file and rename the new file as email.jsw and copy all the code for this.

Then do exactly the same and call the other new backend file as sendGrid.js and copy the code for this.

Note that these backend names must match up in all code, so upper and lower case are all important, they must be exactly the same in all codes.

Finally, go back to your page that you have your form in and add the ‘Event Handler’ part of the code into the page code.

You will need to change the code in the ‘Event Handler’ on your page so that it includes all the user inputs that you have in your form - (the part where it says \rEmail: ${$w(“#emailInput”).value} and so on, making sure that you only change the element name itself.

Also, if you are using SendGrid, then I suggest you also set up server authentication and domain authentication, so that you don’t get the via.sendgrid.net on your emails and the servers see the email as from your own domain rather than from SendGrid.
https://sendgrid.com/docs/glossary/sender-authentication/
https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/