Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 546
Ian Macalinao Avatar asked May 26 '13 01:05

Ian Macalinao


People also ask

How do I send an email to multiple recipients in SendGrid?

The most straightforward way to send bulk emails is to have an array of addresses in the to field, and then call sendMultiple with a single message object. Copy this code into index. js and replace the emails in the to array with your email addresses. const sgMail = require('@sendgrid/mail'); sgMail.


1 Answers

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' }); 
like image 164
Incinerator Avatar answered Sep 17 '22 23:09

Incinerator