export async function uploadButton1_change(event) {
await sleep(1000);
$w(‘#dataset1’).save();
//Add your code for this event here:
var nodemailer = require (‘nodemailer’);
var transOptions = {
host: ‘smtp.gmail.com’,
port: 587,
secure: false ,
auth: {
user: ‘…’,
pass: ‘…’
}
};
var transporter = nodemailer.createTransport(transOptions);
var mainOptions = {
from : ‘…’,
to: ‘…’,
subject: ‘hello’,
text: ‘hello world!’
};
var callback = function (err, info){
if (err) { throw err }
console.log(‘sent’);
}
transporter.sendMail(mainOptions, callback);
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
Above is my code, after I test it on the live website. I got some errors.

How can I make this work? Thank you for your help.
Have you installed nodemailer through Wix Package Manager if it has it’s own NodeJS available there?
https://support.wix.com/en/article/corvid-managing-external-code-libraries-with-the-package-manager
https://nodemailer.com/usage/
https://www.w3schools.com/nodejs/nodejs_email.asp
You can see if it is available for use on Wix already by checking here.
https://www.wix.com/corvid/npm-modules
According to the list on 21/2/2019 nodemailer-mandrill-transport 1.2.0 was made available.
According to the list on 18/2/2018 nodemailer 4.6.0 was made available.
You will have to request it yourself if that is not what you are looking for and look at using the options below.
Otherwise, you will have to look at using NodeMailers API, if you can have access to it and use either Wix Fetch or Wix HTTP Functions.
See tutorial here about it.
https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-myapi-and-myapiclient
https://www.wix.com/corvid/reference/wix-fetch.html
https://support.wix.com/en/article/corvid-accessing-third-party-services-with-the-fetch-api
https://www.wix.com/corvid/reference/wix-http-functions.html
https://support.wix.com/en/article/corvid-exposing-a-site-api-with-http-functions