Triggered email for newsletter signed ups?

Hi.This might be simple but I lost 2 days trying to figure it out.

I would like customers to sign up to the newsletter,first time sign up to be sent a coupon code

I have two user input fields that collects name and email - I advertise it as sign up to the newsletter.These details are being collected in a database.
When somebody enters their details I would like to be sent out a triggered email that send them a coupon code.Can’t seem to make it work

What I accomplished so far :
Have a light box,within the light box two user input fields,when data is entered and customer press submit the data is being inserted in the dataset.I have set up a triggered email from wix,got the code,pasted the code to the lightbox.

Where is the problem:
Data is being inserted to the database but no actual email is being sent out.

Can anyone help?

I have read on wix api documentation that only members can receive triggered emails?But when I created the triggered email there is the option to get the code for “new contact”.
Is there a way to accomplish this with wix code?
Thank you

https://support.wix.com/en/article/wix-code-tutorial-sending-an-email-on-form-submission
https://support.wix.com/en/article/wix-code-tutorial-sending-a-triggered-email-to-contacts

HI,thank you for your reply.I have already followed the idea of sending triggered emails to new contacts,but it is not working. It is not clear if people need to have a membership account or they can receive the email just by entering their email address