On button click, send a command over a channel to your main process and send the mail using an available SMTP server (many freemail services offer to use theirs with your account, just google for your provider)
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
port: 25,
host: 'example.com',
});
const mailOptions = {
from: 'Script <script@example.com>', // sender address
to: 'a@example.com; b@example.com', // list of receivers
subject: 'Hello World', // Subject line
html: '<h1>Hello!</h1>', // html body
};
transporter.sendMail(mailOptions, (error, info) => {
if(error) {
console.log('ERROR!\n\n' + error);
return;
}
});