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

260
Views
How to send emails using smtp node mailer

I was trying to send a test email using SMTP on node mailer but it says connection timed out. the snippet I was using is down below.

const nodemailer = require("nodemailer");

async function main() {

  const nodemailer = require('nodemailer');
  let transporter = nodemailer.createTransport({
        pool:true,
         host: '213.55.96.132',
         port: 25,
         auth: {
             user: "user@ethionet.et",
             pass: "drafgthsjaid321##"
         },
         pool: true,
         logger :true,
         debug:true,
         secure: false,
 })
  transporter.verify(function(error, success) {
    if (error) {
         console.log(error);
    } else {
         console.log('Server is ready to take our messages');
    }
 });
 let mailOptions = {
    from: "user@ethionet.et",
    to: ["someemail@gmail.com",],
    subject: 'Test email',
    text: `Hello world`
  };
  transporter.sendMail(mailOptions, function(err, data) {
if (err) {
    console.log("Error " + err);
} else {
    console.log("Email sent successfully");
}
  });

}


main().catch(console.error);

I don't mind leaking the credentials and it works when i try and send emails through SMTP from here. why is this faliing?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You need to read a little more than the first page of documentation :)

Create your message

let message = {
    ...,
    from: 'mailer@nodemailer.com', // listed in rfc822 message header
    to: 'daemon@nodemailer.com', // listed in rfc822 message header
    envelope: {
        from: 'Daemon <deamon@nodemailer.com>', // used as MAIL FROM: address for SMTP
        to: 'mailer@nodemailer.com, Mailer <mailer2@nodemailer.com>' // used as RCPT TO: address for SMTP
    }
}

Send the message through the transporter

transporter.sendMail(...).then(info=>{
    console.log('Preview URL: ' + nodemailer.getTestMessageUrl(info));
});
about 4 years ago · Juan Pablo Isaza Report

0

Turns out the problem was that my ISP blocks port 25.

about 4 years ago · Juan Pablo Isaza Report
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!