Hi,
I’d really like a little help please.
Having followed the Wix
how to guide and using coding provided by my triggered email I’ve got an error.
I’ve attached the screen shot of the error and my coding.
Because of the error I then followed these links…
So not only do I have code for a triggered email (which would be my preference) I also has a backend function that sends an email through SendGrid.
Your help would be very much appreciated in resolving my error. I can’t say I’ve ever used code before but have given it a try using your helpful guides.
Coding from page…
import {sendEmail, sendEmailWithRecipient} from ‘backend/email’;
$w.onReady( function () {
$w(“#dataset2”).onAfterSave(sendFormData);
});
function sendFormData() {
const subject = Copy of my message **for** Emmy ${$w("#input3").value}
;
const body = Message: ${$w("#input5").value} \rName: ${$w("#input3").value} \remail address: ${$w("#input4").value} \rMessage **for** Emmy: ${$w("#input5").value}
;
const recipient = $w(“#input4”).value;
sendEmailWithRecipient(subject, body, recipient)
.then(response => console.log(response));
sendEmail(subject, body)
.then(response => console.log(response));
}
import wixCRM from ‘wix-crm’;
// …
wixCRM.emailContact(‘NewMessage’, , {
variables: {
name:
}});
import wixCrm from ‘wix-crm’;
// …
let contactId = // get contact ID
let value1 = // value for variable1
wixCRM.emailContact(“emailID”, contactId, {
“variables”: {
“variable1”: value1,
}
} )
.then( () => {
console.log(“Triggered email sent”);
} )
. catch ( (err) => {
console.log(err);
} );
export function button8_click(event, $w) {
//Add your code for this event here:
}wixCRM.emailContact(‘NewMessage’, , {
variables: {
name:
}});
Many thanks,
Em