Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

262
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

0

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

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda