i have a question about nodemailer. Im trying to send a email to a user.
My Code:
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);
}
});
Thats in my packge.json "nodemailer": "^6.7.5",
This code shots the 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