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

477
Views
Error: connect ECONNREFUSED 127.0.0.1:587 nodemailer

i created a contact form with nodemailer and when I submit the form i get this error. I allready use App Password... I am really unsure what the problem is...

Here is the Code:

const smtpConfig = {
transport: {
    host: 'smtp.gmail.com',
    port: 465,
    secure: true,
    auth: {
        user: process.env.EMAIL,
        pass: process.env.APPPASS
      },
   },
};
 let transporter = nodemailer.createTransport(smtpConfig);
 // verify connection configuration
transporter.verify(function(error, success) {
if (error) {
    console.log(error);
} else {
    console.log("Server is ready to take our messages");
}
});

app.post("/send", (req, res) => {
let form = new multiparty.Form();
let data = {};
form.parse(req, function(err, fields) {
    Object.keys(fields).forEach(function(property) {
        data[property] = fields[property].toString();
    });
    console.log(data);
    const mail = {
        sender: `${data.name} <${data.email}>`,
        to: process.env.EMAIL, // receiver email,
        subject: data.subject,
        text: `${data.name} <${data.email}> \n${data.message}`,
    };
    transporter.sendMail(mail, (err, data) => {
        if (err) {
            console.log(err);
            res.status(500).send("Something went wrong.");
        } else {
            res.status(200).send("Email successfully sent to recipient!");
        }
    });
});
});

And the Error which I get is :

Error: connect ECONNREFUSED 127.0.0.1:587 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16) { errno: -4078, code: 'ESOCKET', syscall: 'connect', address: '127.0.0.1', port: 587, command: 'CONN' }

I hope someone of u guys can help me out. Thanks ;)

about 4 years ago · Santiago Trujillo
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!