Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

371
Views
nodemailer send email, Module not found: Can't resolve 'fs' and 'dns'

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
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!