Following the Wix Code tutorial, I've set a upload photo section in my site, with "choose photo" button, image frame and "upload" button. Now I want to send the photo automatically to an email address. How can I do that?
This is the code:
export function button2_click(event, $w) {
if($w("#uploadButton3").value.length > 0) {
$w("#text3").text = `Uploading... ${$w("#uploadButton3").value[0].name}`;
$w("#uploadButton3").startUpload()
.then( (uploadedFile) => {
$w("#text3").text = "Foto enviada com sucesso";
$w("#image18").src = uploadedFile.url;
})
.catch( (uploadError) => {
$w("#text3").text = "Erro no upload";
console.log(`Error: ${uploadError.errorCode}`);
console.log(uploadError.errorDescription);
});
}
else {
$w("#text3").text = "P.f. selecione uma foto para upload.";
}
}
Hi,
You can check out this post to learn how to design your Email notification (and include images).
Click here to read to article about How to Send an Email on Form Submission.
Good luck,
Tal.