tengo una pregunta sobre nodemailer. Estoy tratando de enviar un correo electrónico a un usuario.
Mi código:
var nodemailer = require('nodemailer'); var transporter = nodemailer.createTransport({ service: 'gmail', auth: { user: 'vh.yuval@gmail.com', pass: '(Pw here)' } }); var mailOptions = { from: 'vh,yuval@gmail.com', to: 'bhaliv@bbcag.ch', subject: 'Sending Email using Node.js', text: 'That was easy!' }; transporter.sendMail(mailOptions, function(error, info){ if (error) { console.log(error); } else { console.log('Email sent: ' + info.response); } });Eso está en mi paquete.json "nodemailer": "^6.7.5",
Este código dispara el error:
./node_modules/nodemailer/lib/mailer/index.js:14:0 Module not found: Can't resolve 'fs' (also 'dns') Import trace for requested module: ./node_modules/nodemailer/lib/nodemailer.js ./pages/objects.js https://nextjs.org/docs/messages/module-not-found