'Sendgrid send mail in nodejs 403 response forbidden error

i am using sendgrid mail for sending email below is my code

let mailOptions = {
    from: '"ZERTZ." <[email protected]>',
    to: toAddress,
    subject: "Please confirm your Email account",
    html: html,
  };

this is to send mail

sgMail
  .send(mailOptions)
  .then(() => {
    console.log('Email sent')
  })
  .catch((error) => {
    console.error(error)
  })

here is the error

ResponseError: Forbidden
    at D:\OFFICE\Zertz\Web Application\Web app\Zertz-webapp\node_modules\@sendgrid\client\src\classes\client.js:146:29 
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 403,
  response: {
    headers: {
      server: 'nginx',
      date: 'Tue, 18 Jan 2022 10:15:23 GMT',
      'content-type': 'application/json',
      'content-length': '281',
      connection: 'close',
      'access-control-allow-origin': 'https://sendgrid.api-docs.io',
      'access-control-allow-methods': 'POST',
      'access-control-allow-headers': 'Authorization, Content-Type, On-behalf-of, x-sg-elas-acl',
      'access-control-max-age': '600',
      'x-no-cors-reason': 'https://sendgrid.com/docs/Classroom/Basics/API/cors.html',
      'strict-transport-security': 'max-age=600; includeSubDomains'
    },
    body: { errors: [Array] }
  }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source