sendinblue: Add X-SMTPAPI header to avoid email delivery delays

45 views Asked by At

When a user signs up on our website, we send them a verification email. We would like to ensure the delivery time of this email.

We have been using sendgrid to send these emails. By following this notice, we add X-SMTPAPI header to the emails as follows

class EmailService {
  sendMail (options) {
    return sgMail.send({ 
      to: options.to,
      from: '[email protected]',
      subject: options.subject,
      text: options.text,
      html: options.html,
      headers: {
        'X-SMTPAPI': JSON.stringify({
        category: options.category,
        unique_args: options.unique_args,
        }),
      },
    }, (error, response) => {
      if (error) {
        console.log(error)
      } else {
        console.log('send mail successfully')
      }
    })
  }
}

Now we plan to use sendinblue to send these emails. We first want to use official libraries of sendinblue such as https://github.com/sendinblue/APIv3-nodejs-library. Then, I did not find how to add such a X-SMTPAPI header. Does anyone know how to do that?

0

There are 0 answers