Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Email is not sent to user's email address in *.js

I am going to send 5 digits to user’s email address. But it is not being sent.
Here is codebase below.

const mailOptions = {
  from: 'example@gmail.com',
  to: email,  
  subject: 'Password Reset Token',
  text: `Your password reset token is: ${token}`
};

transporter.sendMail(mailOptions, (error, info) => {
  if (error) {
    console.log(error);
    res.status(500).json({ message: 'Error sending email' });
  } else {
    console.log('Email sent: ' + info.response);
    res.json({ message: 'Token sent to email!' });
  }
});

Please let me know what I should fix.

I couldn’t see any emails were sent. Please let me know the issues. Thanks.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You have to use google app password to send an email by using the gmail.

https://support.google.com/accounts/answer/185833?hl=en

I think you used normal password for the your mailer.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading