So basicly what i want do is have a so i can send email to user that is already typed up in the code bellow and when i click a button it sends a email to that person. I have page set up and etc just cant seem get the button use the code and send email not sure if code is even right.
This what i have but its not working still not sure what i am missing.
import {sendEmail, sendEmailWithRecipient} from 'backend/email';
export function button12_click(event) {
$w("#dynamicDataset").onAfterSave(sendFormData);
}
function sendFormData() {
const subject = `App Approved`;
const body = `Your App has been denied ${$w("#text8").text}
\rReasoning: ${$w("#textBox1").value}`;
const recipient = $w("#text12").text;
sendEmailWithRecipient(subject, body, recipient)
.then(response => console.log(response));
sendEmail(subject, body)
.then(response => console.log(response));
console.log(`Your message has sent`);
}
Hi,
Make sure you change the ID of the elements ("dynamicDataset" for example) to the right ID of the element in your site.