Trigger email code

Hey there is this new wix update!! Where you can trigger an email after an action I tried but did not succeeded.This is my code someone help me please :slight_smile:

$w.onReady( function () {
$w(“dataset3”).onAfterSave( () => {
if (wixUsers.currentUser.loggedIn) {
const userId = wixUsers.currentUser.id;

wixUsers.emailUser(‘contactbericht’, userID, {

  } )  .then( () => { 
      $w('#text220').show(); 
  } ) 
    . **catch** ( (err) => { 
      $w('#text219').show(); 

} );
}
});
});

I think it might just not be working right now, my already existing and previously working triggered emails have also stopped working

thanks~!

Whait but it says type error: $w(…) onafterSave is not a function …?

Try
$w(“#dataset3”).onAfterSave( ()

(note the #)

Hi,
Check out this article about creating triggered emails.