How to send email using send grid?

 I am using firebase cloud function for sendgrid email

const sgMail = require('@sendgrid/mail');
sgMail.setApiKey("");

 

 
 
export function sendEmail(toanysubjectanytextanyhtmlany) {
  const msg = {
    to: to,
    from: 'example@email.com',
    subject: subject,
    text: text,
    html: html,
  };
  (async () => {
    try {
      await sgMail.send(msg);
    } catch (exceptions) {
      console.error(exceptions);
      return exceptions;
    }
  })();
}
Previous
Next Post »