Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending mail without authentication using nodejs

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?

like image 479
NagaLakshmi Avatar asked Jun 18 '15 12:06

NagaLakshmi


People also ask

Can you send emails with node js?

Whether you're building the next Gmail, cutting-edge email marketing software, or just want to program notifications into your Node. js app, it's easy to send emails using readily-made tools and services. Node. js is one of the most popular (if not the most popular) server-side runtime environment for web applications.

Does SMTP need password?

Why you shouldn't use SMTP servers without authentication. Let's say your company supplies an email address for your employees. However, there is no need for authentication to connect to the email server. So, they don't have to enter a username and password to send an email.


2 Answers

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.

like image 128
Matthew Cordaro Avatar answered Sep 18 '22 12:09

Matthew Cordaro


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: '[email protected]',
  to: '[email protected]',
  subject: 'Hello World',
  html: 'Mail of test sendmail '
}, function (err, reply) {
  console.log(err && err.stack)
  console.dir(reply)
})
like image 27
LeOn - Han Li Avatar answered Sep 18 '22 12:09

LeOn - Han Li