Back to Sendgrid Nodejs

Flexible Address Fields

docs/use-cases/flexible-address-fields.md

8.1.6594 B
Original Source

Flexible email address fields

The email address fields (to, from, cc, bcc, replyTo) are flexible and can be any of the following:

js
const msg = {

  //Simple email address string
  to: '[email protected]',

  //Email address with name
  to: 'Some One <[email protected]>',

  //Object with name/email
  to: {
    name: 'Some One',
    email: '[email protected]',
  },

  //Arrays are supported for to, cc and bcc
  to: [
    '[email protected]',
    'Some One <[email protected]>',
    {
      name: 'Some One',
      email: '[email protected]',
    },
  ],
};