remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development

Home Page:http://nodemon.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

alanbarznji opened this issue · comments

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));
}}

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

Hi can i work on this?

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.