triggered email worked once

i tried in many ways to activate triggered email, without using a 3rd party.
first i tried this, and it only send one email [tried also from another device’ didnt work] but interestingly it worked a few more times but only for the same email, if i filled in the form another email address it didnt work:

import wixCrm from 'wix-crm';

$w.onReady(function () {
  $w("#button8").onClick( () => {
    wixCrm.createContact( {
      "firstName": $w("#input8").value,
      "lastName": $w("#input7").value,
      "emails": [$w("#input6").value],
      "phones": [$w("#input5").value]
    } )
    .then( (contactId) => {
      wixCrm.emailContact("JobApl", contactId, {
        "variables": {
          "name": $w("#input8").value
        }
      } );
    } );
  } );
} );

afterwards i itried this code which made sense but didnt work at all:

import wixCRM from 'wix-crm';

$w.onReady(function () {
  $w("#dataset1").onAfterSave(() => {
 let email = $w("#input6").value;
 let firstName = $w('#input8').value;
 let lastName = $w('#input7').value;
 let phone = $w("#input5").value;

wixCRM.createContact({ 
 "firstName": firstName,
 "lastName": lastName,
 "emails": [email],
 "phones": [phone]

      }) 
      .then((contactId) => { 
 return wixCRM.emailContact('JobApl', contactId, { 
 "variables": { 
 "email": email,
 "name": firstName
          } 
        });  
      }) 
      .catch((err) => { 
 // handle the error if the email wasn't sent
        console.log(`Error: ${err}`);
      }); 
  }); 
}); 

anybody knows how to fix it?
TNX :slight_smile:
btw, as u migh already understood im pretty new to this, anybody knows where i can find site log?

any help? plzzzz