Help! wixUsers emailUser not working

Hi there,

I am trying to send a triggered e-mail after user doing some task on my site, using the code below:

import wixUsers from ‘wix-users’;

$w.onReady( function () {
let userId = wixUsers.currentUser.id;
console.log(userId);

let response = wixUsers.emailUser(“emailAplic”, userId)
.then( () => {
console.log(“Email enviado com sucesso!”);
console.log(response);
} )
. catch ( (err) => {
console.log(err);
} );

console.log("Retorno"); 
console.log(response); 

});

The Promise return status “resolved” but the e-mail never arrives. I had double checked emailID and other arguments, and can’t see any errors…

What am I missing out?

Thanks in advance.

Hi alexandreholland,
First things first, did you created your triggered email?
if not, you can follow the instructions on how to do so here:
https://support.wix.com/en/article/creating-a-triggered-email

also, I have tried to recreate your code and it works for me, however the email automatically reached my ‘Promotions’ folder instead of my ‘Primary’ folder in my inbox.
Check your ‘Promotions’ and your ‘Spam’ folders in your inbox and see if the email is there.

Good Luck!
-Lior

Hi Lior,

Yes, I have created the triggered e-mail with the ID showed. It‘s even more weird the code works for you and don’t for me!
I have doubld checked and the e-mail was not sent. Any idea?

Did you try to send the email to the address you’re sending from?
As in ‘send to yourself’?