-1

I have setup local smtp server in my linux machine. The following command works and successfully received mail from test@<machine-name>.

echo “THIS IS A TEST EMAIL” | mail -s "This is subject" xxxx@gmail.com

Whereas I need to send mail using nodemailer which I have configured as below,

    const transporter = nodemailer.createTransport({
        host:"smtp.<ourserver>.com",
        secure:false
    });
    const info = await transporter.sendMail({
        from: 'test@<machine-name>', // sender address
        to: 'xxxx@gmail.com', // list of receivers
        subject: "Hello", // Subject line
        html: "<i>Hello world</i>" // html body
    });

But I am getting the following error,

enter image description here

Any idea why I am facing this issue?

I have seen similar questions posted in quora but none of them solved my problem.

With emailjs, it works with the following config,

  const { SMTPClient } = require('emailjs');
  const client = new SMTPClient({
       host: 'smtp.<ourserver>.com',
       ssl: false,
       tls: false
  });
  client.send(
    {
       text: 'Hello',
       from: 'test@<machine-name>',
       to: 'xxx@gmail.com',
       subject: 'Hello',
    },
    (err, message) => {
         //
    }
 );

How can I make it work using nodemailer?

Rob
  • 14,746
  • 28
  • 47
  • 65
vbrin27
  • 723
  • 1
  • 6
  • 25
  • **DO NOT post images of code, data, error messages, etc.** - copy or type the text into the question. [ask] – Rob Sep 22 '20 at 10:37

1 Answers1

1

This is a firewall problem. Please have a look there first - maybe you can disable it for testing purposes?

The problem has already been discussed here.

Gregor Wedlich
  • 654
  • 6
  • 14