sendgrid-nodejs icon indicating copy to clipboard operation
sendgrid-nodejs copied to clipboard

To field only accepts plain email

Open agostonbonomi opened this issue 7 years ago • 3 comments

Issue Summary

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]'} ).

Steps to Reproduce

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);

Technical details:

  • sendgrid-nodejs Version: master (latest commit: [commit number])
  • Node.js Version: 4.1.2

agostonbonomi avatar Mar 13 '19 12:03 agostonbonomi

Hello @agostonbonomi,

Here are the supported methods of formatting email.

Please let me know if that helps.

Thanks!

With Best Regards,

Elmer

thinkingserious avatar Mar 19 '19 17:03 thinkingserious

hey @thinkingserious , thanks for this. i missed this in the docs, works fine :)

agostonbonomi avatar Mar 25 '19 16:03 agostonbonomi

Thank for the follow up @agostonbonomi!

thinkingserious avatar Mar 25 '19 21:03 thinkingserious