How to send triggered email on form submit to my own email address??? - Please help!

Hello,

I created a custom form using code (no datasets) & I managed to send an email to the USER who submitted the form. However, I wasn’t able to send an email notification to ME. I tried the same method as sending the email to the USER, but that didn’t work.
Here is the code I used to send the email to the user (which works):

if(wixUsers.currentUser.loggedIn) {
 const userId = wixUsers.currentUser.id;
 wixUsers.emailUser("email",userId, {
                variables: {
 "photo": $w("#textBox1").value 
                }
            })

But, I also tried sending it to ME (which doesn’t work ) :

wixUsers.emailUser("email",testemailaddress@gmail.com, {
                variables: {
 "photo": $w("#textBox1").value 
                }
            })

This didn’t work. Is there a solution???

Thanks

Note:
testemailaddress@gmail.com isn’t my real email address

This link might help you. https://support.wix.com/en/article/corvid-tutorial-sending-a-triggered-email-to-contacts

Thanks for your reply. Ok, the tutorial isn’t exactly what I wanted. It is kind of the same as sending an email to the current logged in user who submitted the form. I only want the email to be sent to MYSELF. Maybe creating a database “email” & add my email address & make the email send to my email address after the form is submitted. Is there a way to code that? Or is there a better way?:grin:

The code that @salman-hammed provided didn’t work (here: https://www.wix.com/corvid/forum/main/comment/5f2e90e964c9570017facae1 ), so I got creative. The form was created with code only. That is why I couldn’t use Automations (ascend by Wix). That is why I did this:

  1. add a database

  2. add a dataset

  3. connect the form to the dataset

  4. add an automation (ascend by Wix)

When the submit button is clicked, the form goes to the main database (with code) & goes to the database that triggers the automation(using a dataset). I wonder why nobody thought of that before(including me​:sweat_smile:).:grin: