Adding a name to the "from" field in SendGrid in Node.js

Ian Macalinao picture Ian Macalinao · May 26, 2013 · Viewed 10.2k times · Source

I want to add a name to my "from" field using the SendGrid API, but I do not know how to do this. I tried setting the "from" parameter in sendgrid.send to Name <[email protected]> but that didn't work. Thanks.

Answer

Incinerator picture Incinerator · Dec 20, 2017

Updated example with the syntax used in the latest version of the Sendgrid Node.js library.

sendgrid.send({
  to: '[email protected]',
  from: {
      email: '[email protected]',
      name: 'Sender Name'
  },
  subject: 'Hello World',
  text: 'My first email through SendGrid'
});