When using '@sendgrid/mail' to send any email, the 'to' field only accepts plain email addresses, not name/email format (example: {name:'John Doe', email:'[email protected]'} ).
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
to: { email:'[email protected]', name: 'John Doe' },
from: '[email protected]',
subject: 'Sending with SendGrid is Fun',
text: 'and easy to do anywhere, even with Node.js',
html: '<strong>and easy to do anywhere, even with Node.js</strong>',
};
sgMail.send(msg);
Hello @agostonbonomi,
Here are the supported methods of formatting email.
Please let me know if that helps.
Thanks!
With Best Regards,
Elmer
hey @thinkingserious , thanks for this. i missed this in the docs, works fine :)
Thank for the follow up @agostonbonomi!