Here are the screenshots and code attached Code:
exports.forgotPassword = async function(req, res, next) {
     //Check if user exists
     const user = await User.findOne({ email: req.body.email })
     if (!user) {
         return next(new AppError('There is no user with this email address', 404))
     }
     //Generate the random reset token 
     const resetToken = user.createPasswordResetToken()
     await user.save({ validateBeforeSave: false });
     //send it to user's mail
     const resetURL = `${req.protocol}://${req.get('host')}/api/users/resetPassword/${resetToken}`;
     const message = `Forgot your Password? Submit a patch request with your password and confirm password to ${resetURL}`
     try {
         await sendEmail({
             email: user.email,
             subject: 'Your password reset token(valid for 10 min)'
         })
         res.status(200).json({
             status: 'success',
             message: 'Token sent to Email'
         })
     } catch (err) {
         user.passwordResetToken = undefined;
         user.passwordResetExpires = undefined;
         await user.save({ validateBeforeSave: false });
         return next(new AppError('There was an error sending the email. Please try again later!'), 500);
     }
 }
Error Message :
Error: There was an error sending the email. Please try again later!
    at exports.forgotPassword (D:\FYP\controllers\authController.js:94:22)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error: getaddrinfo ENOTFOUND smtp.mailtrap.io;
    at GetAddrInfoReqWrap.onlookup [as oncomplete] 
(node:dns:71:26) {
  errno: -3008,
  code: 'EDNS',
  syscall: 'getaddrinfo',
  hostname: 'smtp.mailtrap.io;',
  command: 'CONN'
}