Triggered Emails after form submission

Hello,

I am trying to create a triggered email to let the person who filled out the form that approval is pending. I was able to set up the email in WIX and I was given the code to put on my page, but I don’t know on what line to fill in the code, and how to fill in the fields. I son’t want to use a third party for my emails like sendgrid. Can someone help me? I do not have a background in coding at all. This is the code I was given:

wixUsers.emailUser(“QsKHpr7”, );

and this is how it looks at the moment:

Thank you very much!

Hi,

First, you’ll need to import wixUsers:

import wixUsers from 'wix-users';

Then, decide what action should trigger the email. For example, click on a submit button:

import wixUsers from 'wix-users';

$w("#submitButton").onClick((event, $w) => {
 let userId = wixUsers.currentUser.id;
    wixUsers.emailUser('QsKHpr7', userId)
        .then(() => {
            console.log("Triggered email sent");
        })
        .catch((err) => {
            console.log(err);
        });
});

Oh thank you so much! that makes sense.

Is this actual code that I would be able to use on my site?

Hi,

Yes, it should work if you modify the button id ( #submitButton ) to match the id of the button on your page.

Thank you so so much!!