title: Email is not sending through sendgrid and also not showing any error/ node.js
body: <p>auth.js
  Whenever I try to register new account it's shows me an error 'message&quot; unauthorized', i am not getting what exactly happen.</p>
  <p><img src="https://i.stack.imgur.com/cMNmn.png" alt="enter image description here" /></p>
  <pre><code>exports.register = async (req, res) =&gt; {
      try {
          const { email } = req.body;
  
          // Make sure this account doesn't already exist
          const user = await User.findOne({ email });
  
          if (user) return res.status(401).json({message: 'The email address you have entered is already associated with another account.'});
  
          const newUser = new User({ ...req.body, role: &quot;basic&quot; });
  
          const user_ = await newUser.save();
  
          await sendVerificationEmail(user_, req, res);
  
      } catch (error) {
          res.status(500).json({success: false, message: error.message})
      }
  };
  </code></pre>
  <p>sending email for verification</p>
  <pre><code>async function sendVerificationEmail(user, req, res){
      try{
          const token = user.generateVerificationToken();
  
          // Save the verification token
          await token.save();
  
          let subject = &quot;Account Verification Token&quot;;
          let to = user.email;
          let from = process.env.FROM_EMAIL;
          let link=&quot;http://&quot;+req.headers.host+&quot;/api/auth/verify/&quot;+token.token;
          let html = `&lt;p&gt;Hi ${user.username}&lt;p&gt;&lt;br&gt;&lt;p&gt;Please click on the following &lt;a href=&quot;${link}&quot;&gt;link&lt;/a&gt; to verify your account.&lt;/p&gt; 
                    &lt;br&gt;&lt;p&gt;If you did not request this, please ignore this email.&lt;/p&gt;`;
  
          await sendEmail({to, from, subject, html});
  
          res.status(200).json({message: 'A verification email has been sent to ' + user.email + '.'});
      }catch (error) {
          res.status(500).json({message: error.message})
      }
  }
  </code></pre>
  <p>Please if you find any solution reply as soon as possible
  TIA</p>