7

I'm able to send email with any email address without password in a Linux machine using sendmail. Is there any option like this to do it programmatically using node.js in windows?

NagaLakshmi
  • 715
  • 3
  • 12
  • 24
  • You might want to take a look at nodemailer module https://github.com/andris9/Nodemailer – Ben Jun 18 '15 at 12:37
  • 1
    @Ben nodemailer asks for authentication – NagaLakshmi Jun 18 '15 at 13:00
  • @NagaLakshmi then you're probably not using it correctly. Take a look at the [`nodemailer-sendmail-transport`](https://github.com/andris9/nodemailer-sendmail-transport) module. – robertklep Jun 18 '15 at 13:55

2 Answers2

4

Use NodeMailer. This will give you two options:

  1. You can remove auth from the example code when creating a SMTP Transport message if you have local IIS SMTP turned on. Obviously, set host: 'localhost' and the other settings to match your SMTP.

  2. Alternatively, you might be able to make use of sendmail-transport with some third party software such as Sendmail for Windows . SMW emulates the unix method. Unfortunately, SMW is no longer maintained.

Matthew Cordaro
  • 677
  • 1
  • 7
  • 26
  • this answer seems to be making some assumptions that Window is involved in some way (IIS, Sendmail for Windows). Can you address how to proceed if this is not the case? – Michael Aug 08 '17 at 17:31
  • @Michael you clearly failed to read the question in which a windows solution is specifically asked for. – tremor Jun 20 '18 at 13:15
  • @tremor Ah, so I did... oops – Michael Jun 20 '18 at 17:31
3

I would recommend take a look at the sendmail library which does not need any smtp/auth to send email. It gives you similar experience to using sendmail in linux server.

const sendmail = require('sendmail')();

sendmail({
  from: 'test@finra.org',
  to: 'YOUR@gmail.com',
  subject: 'Hello World',
  html: 'Mail of test sendmail '
}, function (err, reply) {
  console.log(err && err.stack)
  console.dir(reply)
})
LeOn - Han Li
  • 9,388
  • 1
  • 65
  • 59