@paoloabarcelona Hi Paolo:
Here is where you also need to understand how preview and published work ;-).
It can be difficult to test CRM and USER code because the preview environment and published environment are different.
When previewing code since you are logged into wix (you have to be to access the editor), then you will be prevented from using wix-crm.emailContact as it is only available to Visitors to the site (I don’t understand why completely but there is probably a reason). You should be able to use wix-users.emailUser however as it takes the same contactId to select a user email from the CRM database. To test the wix-crm.emailContact function you need to test using your published site. Just remember to NOT be logged in. Then it should work. Basically a good way to do this is to use wis-users.currentUser and determine if isLoggedIn is true or not. if it is true then use emailUser else use emailContact.
-
Click here to learn How to Send a Triggered Email to Members with Code
-
Click here to learn How to Send a Triggered Email to Contacts with Code
Hope that helps.
Steve