Skip to content

How to add X-SMTPAPI header to avoid email delivery delays? #142

@chengtie

Description

@chengtie

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. Could anyone help?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions