Skip to content

TortoiseFeel

Slow or steady we are moving!

How to add multiple email address to sendgrid nodejs code?

Hello there, welcome to my random question post.

I was facing small issue to add multiple address to bcc to the sendgrid nodejs example :

What I was tried to do ( which was wrong in accepting as sendgrid bcc parameters value)

let testAccount = {
        emailSubject: subjectMsg,
        emailFrom: `Application <${process.env.CESEmailFrom}>`,
        emailTo: email || process.env.OWNER_TO_EMAIL_ADDRESS,
        emailBcc: process.env.OWNER_EMAIL_ADDRESS //note here
 };

(this is just a payload I am preparing to pass to seng-grid function), process.env.OWNER_EMAIL_ADDRESS was holding values like : email1@testdomain.com, email2@testdomain.com so which is incorrect to pass a comma separated string value.

Instead, we just need to tweak a little at the same bcc, line to pass it as Javascript Array value. Here is the example of working code (note the bcc line in the code below):

let testAccount = {
        //user: process.env.CESUsername,
        //pass: process.env.CESPassword,
        emailSubject: subjectMsg,
        emailFrom: `Kitchen Anak <${process.env.CESEmailFrom}>`,
        emailTo: email || process.env.OWNER_TO_EMAIL_ADDRESS,
        emailBcc: process.env.OWNER_EMAIL_ADDRESS && process.env.OWNER_EMAIL_ADDRESS.split(',') || '',
    };

Using javascript split function, I was able pass it as a array, isn’t that simple? ๐Ÿ™‚

Facing other error related to sendgrid bcc option

Along this, I have also then faced error after fixing above, still on my Vercel deployment code, then which was related to sendGrid bcc parameter for multiple email address.

According to sendGrid documentation we should have unique email address for ‘to’, ‘cc’ and ‘bcc’ options while sending email, in my case I was having ‘bcc’ email address set in at ‘to’ option.

Hence, so creating a duplicate error log at API level of code. (attaching screenshot of error occurred) and then fixed it by removing or keeping all the ‘to’ and ‘bcc’ parameters unique! Volia, that simple ๐Ÿ™‚

Log error due to sendgrid bcc email address should be unique.

Result after correcting email address successful.

Successful email send log!

Thanks for visiting & Happy Learning!

Author Moving TortoisePosted on August 20, 2021August 20, 2021Categories LearningTags deployment error, sendgrid bcc email, sendgrid bcc unique error, vercel

Post navigation

Previous Previous post: How to pass multiple data to Laravel compact method from Controller to view blade?
Next Next post: How I have resolve, Module not found, Can’t resolve ‘optimism’
The visuals used in this article are intended for illustrative purposes only. Images are either original creations, digitally created artwork, or sourced from royalty-free image libraries that allow commercial usage. Visuals are used to support editorial storytelling and do not imply affiliation, endorsement, or factual representation.

More Posts

  • Indiaโ€™s Rise in Space: How ISRO Is Competing Globally April 21, 2026
  • AI in Space: How Machines Are Taking Control Beyond Earth April 21, 2026
  • How Satellite Internet Works and Why It Matters in 2026 April 21, 2026
  • The New Space Age: Where Exploration Meets Economics, AI, and Everyday Life April 21, 2026
  • ๐ŸŒ Global Events Shaping 2026 (Part 3): Human Behavior, Culture & The Future of Experience April 8, 2026

ai attention economy base color capacitor css download error February fixed founder free frontend future of work guide gujarat how html india india-state indiastate indiaterritory interview islands javascript laravel learning map Mark Zuckerberg mumbai nextjs performance psychology php react reactjs Sharing social media Social Platform solved state state-india svg svg-map territory train like gold vercel

Recent Best Unseen Apps

Best Tool to Try up!

Sabziyaan

Next handly solution for family!

Recent work from UDW Sabziyaan (just for more shorter to type in the url) build NextJs, React, Graphql, ApolloClient, Javascript, HTML5, CSS3, Bootstrap 5

Like to write?

Email:ย hello@tortoisefeel.com

TortoiseFeel Proudly powered by WordPress