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.
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.
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' });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With