Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chengtie opened this issue Apr 7, 2023 · 0 comments
Open

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

chengtie opened this issue Apr 7, 2023 · 0 comments

Comments

@chengtie
Copy link

chengtie commented Apr 7, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant