0

I tried to send mail without authentication but its throwing error how to achieve it.

mail.js

var transporter = nodemailer.createTransport({
                service: 'gmail',
                auth: {
                  user: params.email,
                }
              });

              var mailOptions = {
                from: 'techardors@gmail.com',
                to: params.email,
                subject: 'Sending Email using Node.js',
                text: 'That was easy!'
              };

              transporter.sendMail(mailOptions, function(error, info){
                if (error) {
                  console.log(error);
                } else {
                  console.log('Email sent: ' + info.response);
                }
              });
hari prasanth
  • 716
  • 1
  • 15
  • 35

1 Answers1

0
  • You have to be authenticate to send an email. So it can show where the email is coming from and similar stuff. This also applies when using nodemailer to send emails. You can only send an email using nodemailer if you are athenticated. And this is because email services tries to avoid spam to users in every way posible.
James
  • 120
  • 1
  • 7