Back to Sendgrid Nodejs

Send Multiple Emails to Multiple Recipients

docs/use-cases/multiple-emails-multiple-recipients.md

8.1.6724 B
Original Source

Send Multiple Emails to Multiple Recipients

The send method also accepts an array of email msg if you want to send multiple different single emails with for example different content and sender values. This will send multiple requests (in parallel), so be aware of any API rate restrictions:

js
const emails = [
  {
    to: '[email protected]',
    from: '[email protected]',
    subject: 'Hello recipient 1',
    text: 'Hello plain world!',
    html: '<p>Hello HTML world!</p>',
  },
  {
    to: '[email protected]',
    from: '[email protected]',
    subject: 'Hello recipient 2',
    text: 'Hello other plain world!',
    html: '<p>Hello other HTML world!</p>',
  },
];
sgMail.send(emails);