remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development
http://nodemon.io/
MIT License
26.21k stars 1.72k forks source link

When I Use Nodemailer to send rest password to email the nodemailer crashed app server and the server are down but the message send #2132

Closed alanbarznji closed 11 months ago

alanbarznji commented 11 months ago

these is my send function const nodemailer = require("nodemailer"); const SendEmail = async (get) => { const transport = nodemailer.createTransport({ service: "gmail", host: process.env.PROCESS_HOST, port: process.env.PROCESS_PORT, secure: true, requireTLS: true, auth: { user: process.env.PROCESS_EMAIL, pass: process.env.PROCESS_PASSWORD, }, tls: { // do not fail on invalid certs rejectUnauthorized: false, }, }); const mailOpts ={ from: "degrees ", to: get.email, subject: get.subject, text: get.message, }; await transport.sendMail(mailOpts,(error, info) => { if (error) { console.error('Error sending email:', error); window.location.reload(true); } else { console.log('Email sent successfully:', info.response); } }) console.log(mailOpts,"kaka"); }; module.exports = SendEmail;

and these my hundle post if(req.body.email){ try{ SendEmail({ email: user.email, subject: "Reset your password", message: Hello ${user.name},\n You have requested a password reset.\n Your Code is :${resetCode}\n Please use it within the next, });
} catch (error) { user.resetCode = undefined; user.expires = undefined; user.isVerified = undefined; await user.save(); return next(new ApiError("There is an error in sending email", 500)); }}

github-actions[bot] commented 11 months ago

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3

abhishektiwari47 commented 11 months ago

Hi can i work on this?

remy commented 11 months ago

I'm not even sure this is actually a nodemon issue, seems specific to nodemailer (literally doesn't mention nodemon in replication details).

Happy to reopen issue if there's replication details.